0% found this document useful (0 votes)
7 views

dbmsprac-1

The document outlines a practical assignment for a DBMS Lab course, detailing various SQL queries related to table management and data manipulation. It includes tasks such as creating, updating, dropping, truncating, and altering tables, as well as inserting, deleting, and selecting records. Each task is accompanied by example queries for clarity.

Uploaded by

Pranjal Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

dbmsprac-1

The document outlines a practical assignment for a DBMS Lab course, detailing various SQL queries related to table management and data manipulation. It includes tasks such as creating, updating, dropping, truncating, and altering tables, as well as inserting, deleting, and selecting records. Each task is accompanied by example queries for clarity.

Uploaded by

Pranjal Jain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

INSTITUTE OF ENGINEERING AND TECHNOLOGY

Mohanlal Sukhadia University , Udaipur


Name- Pranjal Jain | Class- BTech-CSE (IV Sem) | Subject- DBMS Lab

PRACTICAL-1
Q.1. Write queries with use of Create, update ,drop ,truncate ,insert ,delete, alter and other
statements.
a.) Write a query to create a table employees with empno, ename, designation, and salary.

b.) Write a query to display details of employees.


Eg. DESC employee;

c.) Write a query to drop table in a database.


Eg. DROP TABLE employee;
INSTITUTE OF ENGINEERING AND TECHNOLOGY
Mohanlal Sukhadia University , Udaipur
Name- Pranjal Jain | Class- BTech-CSE (IV Sem) | Subject- DBMS Lab

d.) Write a query to truncate table.


Eg. TRUNCATE TABLE employee;

e.) Write a query to insert data into employee table.

f.) Write a query to update designation of John Smith to ‘Sr.Accountant’.


Eg. Update employee
Set designation=’Sr.Accountant’
Where ename=’John Smith’;
INSTITUTE OF ENGINEERING AND TECHNOLOGY
Mohanlal Sukhadia University , Udaipur
Name- Pranjal Jain | Class- BTech-CSE (IV Sem) | Subject- DBMS Lab

g.) Write a query to update multiple records from employee.


Eg. Update employee set salary=16000, designation=’Asst.Prof’ where empno=102;

h.) Alter the table to add primary key.


Eg. Alter table employee add constraint primary key(empno);

i.)Write a query to alter a coloumn.


Eg. Alter table employee modify empno number(6);

j.) Write a query to add a new coloumn into employee.


Eg. Alter table employee add salary number(8);

k.) Write a query to add multiple coloumns into employee.


INSTITUTE OF ENGINEERING AND TECHNOLOGY
Mohanlal Sukhadia University , Udaipur
Name- Pranjal Jain | Class- BTech-CSE (IV Sem) | Subject- DBMS Lab

Eg. ALTER TABLE employee add (DOB date, DOJ date);

l.) Write a query to rename table emp to employee.


Eg. ALTER TABLE rename emp to employee;

m.) Write a query to delete employee with empno 1.


Eg. DELETE from employee where empno=1;

n.) List all employee details.


Eg. Select * from employee;

o.) List all employees who are accountant.


INSTITUTE OF ENGINEERING AND TECHNOLOGY
Mohanlal Sukhadia University , Udaipur
Name- Pranjal Jain | Class- BTech-CSE (IV Sem) | Subject- DBMS Lab

Eg. Select * from employee where designation=’Accountant’;

You might also like