DBMS Lab Manual
DBMS Lab Manual
(DBMS: Database language-DML,DDL,DCL,TCL(write the theory and syntax for each command
present in DDL,DML,DCL,TCL)):
DDL:
Aim: To understand the syntax of basic DDL commands such as
o Create table
o Alter table
▪ Add/Drop attribute
▪ Modify type and size of an attribute
▪ Rename attribute
o Truncate
o Drop
o Insert
o Update
o Delete
Database used: Student
mysql> create table students (rollno int, name char (20), branch varchar (20));
Constraints
Aim: Objective to understand the commands used to impose constraints on a table such as
o Not null
o unique
o primary key
o foreign key
Database used: Bank
Branch ()
Account ()
Loan ()
Customer ()
Depositor ()
Borrower ()
mysql> create table Branch (branch_name varchar (15) , branch city varchar (15) not null,assets
integer not null, primary key(branch_name));
mysql> create table Account (account_number varchar (15), branch_name varchar (15) not
null,balance integer not null, primary key(account_number), foreign key(branch_name)
references Branch(branch_name));
mysql> alter table cust1 add foreign key (cust_no) references cust(cust_no);
(Only syntax)
Exp No: 2
AIM: Analyze the problem and come with the entities in it.
Exp No: 3
AIM: Represent all the entities in tabular fashion for reservation Database
(Tables with maximum 2 entries with output i.e. table diagram using SQL queries)
Exp No:4
AIM: Create a Student Database Table and insert datas using all the SQL queries
(Create, insert, update, delete, drop, alter with output i.e. table diagram)
Exp No:5
(Tables with maximum 2 entries with syntax, query and output i.e. table diagram)
Exp No:6
(MIN, MAX, COUNT, SUM, AVG-write theory about aggregate functions with syntax of
each and its use)
(5 to 6 entries in product table with 5 attributes)
(AND, OR, NOT, NOR, BETWEEN, IN, LIKE {use all like operation symbols},
EXISTS, ALL, ANY- write theory about Logical operators with syntax of each and its
use)
(5 to 6 entries in employee table with 5 attributes)
Exp No:8
AIM: Write SQL query using Group by Function, Having and Order By Function