You are on page 1of 7

SIDDHANT BHALLA

19070124062

IT 3

DBMS ASSIGNMENT 3
Q1)Explain DDL commands and their syntax.

1. CREATE-Used to create new table in SQL.


User has to specify the column names and datatypes.
SYNTAX-Create table table_name(column1 datatype,column2 datatype ….);
2. ALTER-This command is used to make changes to existing table.User can add,delete or make
changes to columns in pre existing table.
SYNTAX-ALTER TABLE table_name
ADD column_name datatype;
3. TRUNCATE-Used to remove all the rows from a table without deleting the structure of the
table.
SYNTAX-TRUNCATE TABLE table_name;
4. DROP-Used to remove all the rows from the table including the structure of the table.
SYNTAX-DROP TABLE Student_info;

Q2)Explain DML commands and their syntax.

 INSERT-Used to insert data in database table.


SYNTAX-insert into table_name values(value1,value2….);
 UPDATE -command or statement is used to modify the value of an existing column in a
database table.
SYNTAX-UPDATE table_name
SET column_name_1 = value1, column_name_2 = value2, ...
WHERE condition;
 DELETE-DELETE statement in SQL is used to remove one or more rows from the database
table.
SYNTAX-DELETE FROM table_name WHERE condition;

Q3) Execute following queries on the library database

1.Which institute libraries are located in pune city?


2. To which institute CS department belongs to?
3.Find all the books whose price is between800 to 12000?
4. Find out such employees who’s salaries are not greater than 50,000/-
5.Find out such sellers who’s name end with “ta”
6.Find out such institute libraries where their area information is missing.
7.Find out such staff members who’s name doesn’t starts with “A”
8.Find out such SIU libraries which have institute libraries located in Bangalore.
9.Which students belong to civil department?
10.Find out books which are written by “shruti” and published by Mcgraw hill.
11.Which members have issued books that belongs to E&TC department of SITM.
12.List the books of SIT library
13.Which books are written by “Ken Coel”
14.Find the staff members who’s salaries are less than atleast one employee
15.Find the books who’s price is greater than atleast one book in the library.
16.Find the employees who’s salary is greater than all the employees of CS department.
17.Find such purchases who’s total cost is greater than all the purchases which are done by
“SIT library”
Department of Computer Science & Information Technology18
18.Find name of such SIU library which is located in Nashik and has Ilibrary named
as “SIOM library”(solve using exists)
19.Find such staff members who’s name starts with “S” and do not work for “CS”
department.(solve using not exists)
20.Which books are issued by student Shivani?
21.From which seller did SIT library purchases books of “Technical publications”?
22.Which books are issued by staff of SSLA law department?
23.Which sellers reside in the same city in which SCHC library resides?
24.Find out the publishers whose books are provided by the seller “pragati books store” to
SSBS library.
25.Which books are published by “Shivam Kapoor” with the publishing house Wiley
publications?
26.What are the purchase details of the SIBM library for the month of December?
27.Which institute does the member belong who have issued book number 453?
28.Increase the price of all the books by 10%.
29.Change the institute name to SSBS of “Biology department”
30.Provide 25% Diwali bonus to SIT staff.
31.Delete the purchase details which are happened in 2016.
32.Delete such issues where books are already returned in 2017

You might also like