0% found this document useful (0 votes)
3 views2 pages

Basic SQL Operations Lab Report

Uploaded by

masszwaker
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)
3 views2 pages

Basic SQL Operations Lab Report

Uploaded by

masszwaker
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

SQL Practical Lab Report

Subject : Database Management System (DBMS)


Experiment : Basic SQL Operations
Objective : To understand table creation, insertion, selection, sorting, deletion, and
dropping of tables using SQL.

1. Table Creation
The following SQL query is used to create a table named 'leptons' with student details and
marks.

CREATE TABLE leptons (


roll_no INT,
name CHAR(10),
phone_no INT,
math INT,
phy INT
);

2. Inserting Values into the Table


The following queries insert records into the leptons table.

INSERT INTO leptons VALUES (01,'Dakki',892,34,35);


INSERT INTO leptons VALUES (02,'Mahi',876,98,0);
INSERT INTO leptons VALUES (03,'Kiru',874,8,34);
INSERT INTO leptons VALUES (04,'Kiran',876,98,0);
INSERT INTO leptons VALUES (05,'Ice',876,98,0);
INSERT INTO leptons VALUES (06,'Dhaks',876,98,0);
INSERT INTO leptons VALUES (07,'Manapa',876,98,0);
INSERT INTO leptons VALUES (08,'Chitthi',876,98,0);
INSERT INTO leptons VALUES (09,'Vijayapa',876,98,0);
INSERT INTO leptons VALUES (10,'Bobby',876,98,0);

3. Sorting Records Using ORDER BY


To display records in ascending order of roll number:

SELECT * FROM leptons ORDER BY roll_no ASC;

To display records in descending order of roll number:

SELECT * FROM leptons ORDER BY roll_no DESC;


4. Selecting Particular Records
The following query displays only selected roll numbers.

SELECT * FROM leptons WHERE roll_no IN (01,03,05,07,10);

5. Deleting Particular Records


The following query deletes records except specified roll numbers.

DELETE FROM leptons WHERE roll_no NOT IN (01,03,05,07,10);

6. Dropping the Table


The following query removes the table permanently from the database.

DROP TABLE leptons;

Conclusion
Thus, basic SQL operations such as CREATE, INSERT, SELECT, DELETE, ORDER BY, and
DROP were successfully executed.

You might also like