Assgnmnt 3
Assgnmnt 3
PRN: 22070122215
Batch:- 2022-26
Sem:- IV
Division: CS (C2)
1
DBMS Lab Assignment -3
Data Definition Language defines the schema for the database by specifying entities and the
relationship among them. In addition to this, DDL even defines certain security constraints.
The execution of DDL statements results in new tables which are stored in “system catalog”
also called data dictionary or data directory.
Data Manipulation Language is a language that provides a set of operations to support the
basic data manipulation operations on the data held in the databases. It allows users to insert,
update, delete and retrieve data from the database. Data manipulations are applied at internal,
conceptual, and external levels of schemas. However, the level of complexity at each schema
level varies from one another.
Data Control Language statements control access to data and the database using statements
such as GRANT and REVOKE. A privilege can either be granted to a User with the help of
GRANT statement. The privileges assigned can be SELECT, ALTER, DELETE, EXECUTE,
INSERT, INDEX etc. In addition to granting of privileges, you can also revoke (taken back) it
by using REVOKE command.
2
SECTION – 1:
3
column_NameN data_type ( size of the column )
);
Example
Q2: Create tables for the following relational model of library management. Apply
constraints on the columns and alter the structure according to your requirements.
ANS:
1. SIULIBRARY (Slid,lname,location,noofbranches)
4
4. Noofcopies(bnid,bid,blid)
5. AUTHOR(Aid, Aname,email,phoneno)
5
7. PUBLISHER(Pid, Pname)
6
11. STAFF(Stid, stname, email, deptid,memid)
7
15. Employee(eid,empname,email,salary,lid)
16. A_specialization(spec_id,spec_name,Aid)
17. Member(memid,lid)
Conclusion:
In this experiment, we learnt how to install MYSQL, what is DDL and its commands, and how to
create tables and display tables in MYSQL.
8
SECTION – 2:
Introduction to DML and its commands
9
1. SIULIBRARY (Slid,lname,location,noofbranches)
10
4. Noofcopies(bnid,bid,blid)
11
5. AUTHOR(Aid, Aname,email,phoneno)
7. PUBLISHER(Pid, Pname)
12
8. SELLER(Sid, slname, city)
13
11. STAFF(Stid, stname, email, deptid,memid)
14
14. SELLS (sid, bid,pid)
15. Employee(eid,empname,email,salary,lid)
16. A_specialization(spec_id,spec_name,Aid)
17. Member(memid,lid)
15
Q3: Execute following queries on the library database.
ANS:
1. Which institute libraries are located in Pune city?
16
4. Find out such employees whose salaries are not greater than 50,000/-
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.
17
9. Which students belong to civil department?
10. Find out books which are written by "shruti" and published by Macgraw
hill.
Conclusion:
In this experiment, we learnt how to use DML commands in SQL and how to
insert and select table values in SQL.
18