DBMS index1
DBMS index1
PART-A
Program Page
No. Program title No.
01 Create a table EMPLOYEE using SQL command to store details of
employees such as EMPNO, NAME, DESIGNATION, DEPARTMENT,
GENDER and SALARY. Specify Primary Key and NOT NULL constraints
on the table. Allow only ‘M’ or ‘F’ for the column GENDER.
DEPARTMENT can be SALES, ACCOUNTS, IT. Choose DESIGNATION
as CLERK, ANALYST, MANAGER, ACCOUNTANT and SUPERVISOR
that depends on department .
Write the following SQL queries:
a) Display EMPNO, NAME and DESIGNATION of all employees whose
name ends with RAJ.
b) Display the details of all female employees who is earning salary within
the range 20000 to 40000 in SALES or IT departments.
c) List the different DEPARTMENTs with the DESIGNATIONs in that
department.
d) Display the department name, total, average, maximum, minimum salary
of the DEPARTMENT only if the total salary given in that department is
more than 30000.
e) List the departments which have more than 2 employees.
02 Create a table CLIENT to store CLIENT_NO, NAME, ADDRESS, STATE,
BAL_DUE. Client no must start with ‘C’. Apply the suitable structure for the
columns. Specify Primary Key and NOT NULL constraints on the table. Insert
10 records.
Write the following SQL queries:
a) From the table CLIENT, create a new table CLIENT1 that contains only
CLIENT_NO and NAME , BAL_DUE from specified STATE. Accept the state
during run time.
b) create a new table CLIENT2 that has the same structure as CLIENT but with
no records. Display the structure and records.
c) Add a new column by name PENALTY number (10, 2) to the CLIENT.
d) Assign Penalty as 10% of BAL_DUE for the clients C1002, C1005, C1009
and for others 8%. Display Records.
e) Change the name of CLIENT1 as NEW_CLIENT.
f) Delete the table CLIENT2.
03 Create a table BOOK using SQL command to store Accession No, TITLE,
AUTHOR, PUBLISHER, YEAR, PRICE. Apply the suitable structure for the
columns. Specify Primary Key and NOT NULL constraints on the table. Insert 10
records.
Write the following SQL queries:
a) List the details of publishers having ‘a’ as the second character in their names.
b) Display Accession No., TITLE, PUBLISHER and YEAR of the books
published by the specified author before 2010 in the descending order of YEAR.
Accept author during run time.
c) Modify the size of TITLE to increase the size 5 characters more.
d) Display the details of all books other than Microsoft press publishers.
e) Remove the records of the books published before 1990.