0% found this document useful (0 votes)
336 views6 pages

Database Management Systems Lab Lab 1 and 2: Create Table Student (Rno, Name, DOB, Gender, Class, College, City, Marks)

The document describes a database management systems lab exercise involving creating a Student table with various attributes, inserting sample records, displaying records, modifying structure and data of the table. It includes 10 questions - creating the Student table, inserting 5 records, displaying all records, showing table structure, querying based on city, sorting by marks, updating marks and name/city for a record, deleting records based on city and marks criteria. The document provides the SQL queries for each step in the lab exercise on creating and manipulating a database table.

Uploaded by

kavya aggarwal
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)
336 views6 pages

Database Management Systems Lab Lab 1 and 2: Create Table Student (Rno, Name, DOB, Gender, Class, College, City, Marks)

The document describes a database management systems lab exercise involving creating a Student table with various attributes, inserting sample records, displaying records, modifying structure and data of the table. It includes 10 questions - creating the Student table, inserting 5 records, displaying all records, showing table structure, querying based on city, sorting by marks, updating marks and name/city for a record, deleting records based on city and marks criteria. The document provides the SQL queries for each step in the lab exercise on creating and manipulating a database table.

Uploaded by

kavya aggarwal
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/ 6

Database management systems lab

Lab 1 and 2

1. Create table Student (Rno, Name, DOB, Gender, Class,


College, City, Marks).
Ans.

Create table Student //syntax= create table tablename


(
Rno int, //specifying attribute with datatype
Name varchar(200),
DOB int,
Gender varchar(1),
Class int,
College varchar(200),
City varchar(200),
Marks int //no comma at the last statement
);
2. Insert 5 records in student table.
Ans.
//syntax
Insert into tablename(attributes)values(answers);

insert into Student (Rno , Name , DOB , Gender ,class, College , City , Marks )
values (1,'kavya', 2003, 'f', 5,'TIET' , 'Patiala', 68);

insert into Student (Rno , Name , DOB , Gender , Class , College , City , Marks )
values (2,'sai', 2004, 'm', 4,'TIET' , 'Patiala’, 70);

insert into Student (Rno , Name , DOB , Gender , Class , College , City , Marks )
values (3,'ruhaan', 2009, 'm',7, 'APJ' , 'Jalandhar', 95);

insert into Student (Rno , Name , DOB , Gender , Class , College , City , Marks )
values (4,'sargun', 2002, 'f', 3,'GNDU' , 'Amritsar', 72);

insert into Student (Rno , Name , DOB , Gender , Class , College , City , Marks )
values (5,'Khanak', 2003, 'f', 9, 'CCA' , 'Chandigarh', 82);

3. Display the information of all the students.


Ans.

Select* from Student

4. Display the detail structure of student table.


Ans.
Desc Student

5. Display Rno, Name and Class information of ‘Patiala’


students.
Ans.
select Rno, Name, class from Student where City='Patiala';

6. Display information on ascending order of marks.


Ans.
SELECT Rno, Name, DOB , Gender , Class , College , City , Marks from Student
ORDER BY Marks;

7. Change the marks of Rno 5 to 89.


Ans.

Update Student
set Marks=89 where Rno=5;
select *from Student;

8. Change the name and city of Rno 3.


Ans.
Update Student set City='New york', Name='Bella' where Rno=3; select *from Student;

9. Delete the information of ‘Amritsar’ city records


Ans. delete from Student where City='Amritsar';
select *from Student;
10. Delete the records of student where marks<30.
Ans. delete from Student where Marks<30;
Select* from Student;

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy