0% found this document useful (0 votes)
2 views10 pages

DBMS Practical File

The document is a submission for a Database Management System (DBMS) course by a BCA student, containing SQL queries related to table operations. It includes queries for creating, modifying, and deleting tables, as well as displaying and updating data within those tables. The document serves as a practical guide for performing various SQL operations in a structured format.

Uploaded by

moonknightpluto
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)
2 views10 pages

DBMS Practical File

The document is a submission for a Database Management System (DBMS) course by a BCA student, containing SQL queries related to table operations. It includes queries for creating, modifying, and deleting tables, as well as displaying and updating data within those tables. The document serves as a practical guide for performing various SQL operations in a structured format.

Uploaded by

moonknightpluto
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/ 10

DBMS

BCA
3RD SEMESTER

SUBMITTED BY: Tejus Tagra


ENROLLMENT NO: A25304824020

SUBMITTED TO: DR. PARAMPREET KAUR


INDEX
S.NO TITLE REMARKS
1 Write a Query to create a table in SQL.

2 Write a Query to display structure of table


in SQL.
3 Write a Query to insert a row in table.

4 Write a Query to display roll number and


name from table.
5 Write a Query to add gender in table
student.
6 Write a Query to modify data type in table.

7 Write a Query to update branch of student


in table.
8 Write a Query to delete entry in a table.

9 Write a Query to rename column in table.

10 Write a Query to rename table in SQL.

11 Write a Query to use Drop Statement.

12 Write a Query to sort entries in a table


using Order By clause.
13 Write a Query to use aggregate functions in
SQL.
S.NO TITLE REMARKS
14 Use of substring comparison.

15 Use of order by statement.

16 Write a Query to insert a row in table.

17 Write a Query to display roll number and


name from table.
18 Write a Query to add gender in table
student.
19 Write a Query to modify data type in table.

20 Write a Query to update branch of student


in table.
21 Write a Query to delete entry in a table.

22 Write a Query to rename column in table.

23 Write a Query to rename table in SQL.

24 Write a Query to use Drop Statement.

25 Write a Query to sort entries in a table


using Order By clause.
26 Write a Query to use aggregate functions in
SQL.
Q1. Write a Query to create a table in SQL.
CODE:

CREATE TABLE student


(
RollNo INT PRIMARY KEY,
Name VARCHAR(20),
Branch VARCHAR(10)
);

OUTPUT:

Q2. Write a Query to display structure of table in SQL.


CODE:

DESC student;
OUTPUT:

Q3. Write a Query to insert a row in table.


CODE:
INSERT INTO student (RollNo, Name, Branch)
VALUES (1, 'Samridh', 'BCA');

OUPUT:

Q4. Write a Query to display roll number and name from table.
CODE:
SELECT ROLLNO, NAME FROM student;

OUTPUT:

Q5. Write a Query to add gender in table student.


CODE:
ALTER TABLE STUDENT ADD GENDER VARCHAR(10);
OUTPUT:

Q6. Write a Query to modify data type in table.


CODE:
ALTER TABLE student MODIFY NAME VARCHAR(30);
ALTER TABLE student MODIFY ROLLNO VARCHAR(5);

OUTPUT:

Q7. Write a Query to update branch of student in table.


CODE:
UPDATE student SET BRANCH='BTECH' WHERE
ROLLNO=1;

OUTPUT:

Q8. Write a Query to delete entry in a table.


CODE:
DELETE FROM student WHERE ROLLNO=1;
OUTPUT:

Q9. Write a Query to rename column in table.


CODE:
ALTER TABLE student RENAME COLUMN NAME TO
STUDENT_NAME;

OUTPUT:

Q10. Write a Query to rename table in SQL.


CODE:
ALTER TABLE student RENAME TO STUDENT_DETAILS;

OUTPUT:

Q11. Write a Query to use Drop Statement.


CODE:
DROP TABLE STUDENT_DETAILS;

OUTPUT:
Q12. Write a Query to sort entries in a table using Order By
clause.
CODE:
SELECT * FROM STUDENT ORDER BY ROLLNO DESC;

OUTPUT:
Q13. Write a Query to use aggregate functions in SQL.
CODE:
COUNT: SELECT COUNT(*) AS ROLLNO FROM STUDENT;

SUM: SELECT SUM(MARKS) AS MARKS FROM STUDENT;

AVG: SELECT AVG(MARKS) AS MARKS FROM STUDENT;

MIN: SELECT MIN(MARKS) AS MARKS FROM STUDENT;

MAX: SELECT MAX(MARKS) AS MARKS FROM STUDENT;

You might also like