bcsl-034 Lab PDF
bcsl-034 Lab PDF
bcsl-034 Lab PDF
3) LIST PROJECTS
SELECT PROJECT_NUMBER, PROJECT_NAME FROM PROJECT;
PROJECT_NUMBER PROJECT_NAME
1 HMS
2 PMS
3 EMS
4) DEPENDENT OF THE EMPLOYEE WHOSE ID IS ‘1’
SELECT *FROM DEPE4NDENT WHERE EMA
PcLcOoYuEnEts_ID=1
Session 2:
Ex 2: This session assume that you are developing a prototype database of the IGNOU library management system,
for that you need to create the following tables:
(a) Book Records
(b) Book details
(c) Member details and
(d) Book issue details
Answer : LIBRARY MANAGEMENT SYSTEM
BOOK_RECORDS TABLE
CREATE TABLE BOOK_RECORDS (ACC_NUMBER NUMBER, ISBN_NUMBER NUMBER);
INSERT INTO BOOK_RECORDS VALUES(100,10);
INSERT INTO BOOK_RECORDS VALUES(101,11);
INSERT INTO BOOK_RECORDS VALUES(102,12);
INSERT INTO BOOK_RECORDS VALUES(103,13);
INSERT INTO BOOK_RECORDS VALUES(104,14);
INSERT INTO BOOK_RECORDS VALUES(105,15);
BOOKS
CREATE TABLE BOOKS (ISBN_NUMBER NUMBER PRIMARY KEY, AUTHOR VARCHAR(30), PUBLISHER
VARCHAR(30), PRICE NUMBER);
INSERT INTO BOOKS VALUES(10,'XYZABC','XXXXXXX',100);
INSERT INTO BOOKS VALUES(11,'XYZABC','XXXXXXX',110);
INSERT INTO BOOKS VALUES(12,'XYZABC','XXXXXXX',210);
MEMBERS TABLE
CREATE TABLE MEMBERS (MEMBER_ID NUBMER PRIMARY KEY,
MEMBER_NAME VARCHAR(30), MAX_BOOKS NUMBER, MAX_DAYS NUMBER);
MIeNm
SEbR
eTr_IiNdTOAM
cEcM
_nBuEm
RS
beVrALIUsEsSu(e1_0d,'XaZteXZXRZe',2tu,2r0n)_; date
INSERT INTO MEMBERS VALUES(11,'XYXYXY',2,20);
INS1E0RT INTO MEM1B1ERS VALU 1E2S/3(/1220,'0Y7XYXYX3Y /1',32/,20)0; 7
INSERT INTO MEMBERS VALUES(13,'YZYZYZ',2,20);
BOOKS_ISSUE
CREATE TABLE BOOKS_ISSUE (MEMBER_ID NUMBER, ACC_NUMBER NUMBER, ISSUE_ATE DATE,
RETIS
UBRN__DnAuTbEmDeAr TE);author publisher price
INSERT INTO BOOK_ISSUE VALUES(10,10,'12-03-2007','13-03-2007');
12 XYZABC XXXXXXX 10000
INSERT INTO BOOK_ISSUE VALUES(10,11,'12-03-2007','13-03-2007');
INSERT IN1T3O BOOK_XISYSZUAEBV CALUYEYSY(1Y1Y,1Y0,'121-030-02007','13-03-2007');
INSERT INTO BOOK_ISSUE VALUES(11,11,'12-03-2007','13-03-2007');
INSERT INTO BOOK_ISSUE VALUES(12,10,'12-03-2007','13-03-2007');
a) Get the list of all books
SELECT *FROM BOOKS;
c) Get the accession number of the books which are available in the library
SELECT DISTINCT(ACC_NUMBER) FROM BOOK_RECORDS;
acc_number
100
ISB1N
01_nubmer author publisher price
102
10310 XYZABC XXXXXXX 100
10411 XYZABC XXXXXXX 110
105
d) List of books iss1u
2ed on 01X-Y
jaZnA-2
B0C05XXXXXXX 10000
SELECT *FR1O3M BOOK_XIS S U
YZABC E W HEYRYEYIY
SYSU
YE_D1A0T0E0=01/01/2005
Session 4:
Ex 4: Create the following table and perform the necessary tasks defined below one by one. You must use the query
Coursmtos/mGerra_pid
tools/ SQL/ Reports/ F hs/ViNew
ams/eusinAgreclaientP/sheorvneer wherever needed.
1 XEXYXY ABC 5252525
Answer : CUSTOMER TABLE
5 XYZXYZ ABC 242424
a) Print entire customer table
SELECT *FROM CUSTOMER;
Expr1000 AREA
2 ABC
b) List the names of those 1customA
erCsDw ho have ‘e’ as second letter in their names
SELECT NAME FROM1 CUSTOD
MER
F WHERE NAME LIKE '_i%'
1 XYZ
MEMBER_ID MEMBER_NAME
12 YXYXYXY
13 YZYZYZ
i) Display all those records from customer table where name starts with ‘a’ or area is ‘abc’
SCEuLsEt omer_id
C T *FROM CUSTOMER
Name WHERE
Area NAMEPhLIKE
one 'A%' OR AREA LIKE '%ABC%'
MEMBER_ID MEMBER_NAME
1 XYXYXY 040 525 2525
10 XZXZXZ
2 XYXYXY 040 252 5250
11 XYXYXY
3 YZYZYZY 040 222222
4 XZXZXZXZ 080 232323
Ex 5: Answer the fo5llowing quXeYriZeX
s YuZsing L0i8b0rary sy2st4e2m42a4s created earlier. You must create a view to know
member name and name of the book issued to them, use any inbuilt function and operators like IN, ANY, ALL,
EXISTS
Answer : LIBRARY MANAGEMENT SYSTEM
a) List the recors of members who have not been issues any book using EXISTS operator
SELECT MEMBER_ID, MEMBER_NAME FROM MEMBERS M WHERE NOT EXISTS
(SELECT *FROM BOOK_ISSUE B WHERE M.MEMBER_ID = B.MEMBER_ID);
b) List the members who have got issued at least one book.
SELECT MEMBER_ID, MEMBER_NAME FROM MEMBERS M WHERE
M.MEMBER_ID IN (SELECT MEMBER_ID FROM BOOK_ISSUE);
REGION_CODE CITY SALESPERSON_CODE SALE_QTY
10 VIJAYAWADA 100 5
Ex 6: Create 1a2 table of EmplDoEyLeeHI(emp-number, na1m0e2, dept, salary) and1D
0
epartment (dept number, dept name).
Insert some records in the tables through appropriate forms having integrity checks. Add some records in employee
table where dep1a3rtment value iV
s InZoAt Gpresent in departm1e0n3t table. 5
Session 6 :
Ex 8: Create the following tables:
Order party : (Order number, Order date, customer code)
Order : Order number, Item code, Quantity
The key to the second table is order-number + item-code
Create a form for data entry to both the tables.
Answer : ORDER MANAGEMENT
ORDER PARTY TABLE
CREATE TABLE ORDER_PARTY(ORDER_NO NUMBER PRIMARY KEY, ORDER_DATE DATE,
CURSTOMER_CODE NUMBER)
ORDER TABLE
CREATE TABLE ORDER(ORDER_NO NUMBER PRIMARY KEY, ITEM_CODE NUMBER, QUANTITY
NUMBER);
1)ORDER AND ORDER PARTY DATA ENTRY FORM
Ex 9: Create a form for storing Bio-data of students. Create the supporting tables to store the data.
Answer : BIO DATA FORM
BIO DATA TABLE
CREATE TABLE BIO_DATE(NUM NUMBER PRIMARY KEY, NAME VARCHAR(20), DOB DATE, PLACE
VARCHAR(20), QUALIFICATION VARCHAR(10), SKILLS VARCHAR(10), EXP NUMBER, ADDRESS
VARCHAR(100));
BIO DATA ENTRY FORM
Ex 10: Design a suitable form for storing basic information and salary details of employees of an organization.
Design and implement the necessary tables.
Answer : EMPLOYEE SALARY DETAILS
EMP TABLE
CREATE TABLE EMP(ENO NUMBER, ENAME VARCHAR(20), DEPT VARCHAR(20), SALARY NUMBER);
EMPLOYEE SALARY ENTRY FORM
Session 8 :
Ex 11: Design a form that shows the status of books pending on a member on entering the member-id.
Answer : Member book issue details using member id and member name
MEMBERS REPORT
Ex 12: Design a form that modifies the records of an Item Table having the fields: Item Code, Item Name,
Quantity, Price, Re-order Level.
Answer : ITEM TABLE DETAILS
ITEM TABLE
CREATE TABLE ITEM(ITEM_CODE NUMBER PRIMARY KEY, ITEM_NAME VARCHAR(50), QUANTITY
NUMBER, PRICE NUMBER, RE_ORDER_LEVEL NUMBER);
Ex 13: Design the form to display the leave information of each employee following. The validations must be made
for the fields.
Answer : Employee leave table
EMP_LEAVE TABLE
CREATE TABLE EMP_LEAVE (EMP_ID NUMBER, REASON VARCHAR(50), L_DATE DATE, MONTH
VARCHAR(5));
a) Leaves information group by Month