0% found this document useful (0 votes)
6 views3 pages

Practical 91 98

mysql

Uploaded by

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

Practical 91 98

mysql

Uploaded by

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

Practical-91 to 98

Aim: Create and manage database using MySQL.


1) Create database named as student_details.
➢ Create database student_details;
➢ Use student_details;

2) Create table student using following details.


Field Name Data type Criteria
Roll_no Number Primary Key
Name Character (10)
DOB Date
Cast Character (5)
Trade Character (5) default ‘COPA’
Fees Number
Percentage Number Not Null

➢ create table student (Roll_no int primary key,Name varchar(10),DOB date,

Cast varchar(5),Trade varchar(5) default 'COPA’,Fees int,


Percentage decimal(4,2) NOT NULL);
➢ desc student;

3) Insert 10 records in the table.


➢ insert into student values (1,'Mohini','2001-02-15','ST','COPA',250,64);

4) show all the records from Student.


➢ Select * from Student;
5) Display list of students having percentage less than 50.
➢ select * from student where percentage<50;

6) Display Name of students who are in ‘CSP’ trade.


➢ select Name from student where Trade='CSP';

7) Display Name of students in descending order of trade.


➢ select Name from student order by name desc;

8) Display Name of student in ascending order.


➢ select Name from student order by name;

9) Display details of Student whose roll no is between 3 and 6.


➢ select * from student where Roll_no between 3 and 6;

10) Display the details of student who are in ‘COPA’,’CSP’ and ‘WM’.
➢ select * from student where trade in ('COPA','CSP','WM');

11) Display the name of student whose name is beginning with ‘R’;
➢ select * from student where name like 'R%';

12) Display the name of students whose name is ending with ‘A’.
➢ select * from student where name like '%A';

13) Display the name of students whose name is 3 character long.


➢ select * from student where name like '_ _ _';

14) Update the trade of student whose roll no is 1 as ‘CSP’.


➢ update student set trade='CSP' where Roll_no=1;

15) Delete record of student whose roll no is 5;


➢ delete from student where Roll_no=5;

16) Display Name, Cast and Fees of student whose cast is ST or GN.
➢ Select Name,Cast,Fees from student where Cast=’ST’ or Cast=’GN’;

17) Add new column Email in student table.


➢ Alter table student Add Email varchar(30);
18) Show the structure of the student table.
➢ desc student;

19) Delete newly added column Email from student table.


➢ Alter table student drop column Email;

20) Rename Table.


➢ rename table student to std;

21) Show database.


➢ Show databases;

22) Show all the tables in Student_detail database.


➢ Show tables;

23) Delete all the records from student table.


➢ Truncate table student;

24) Delete table.


➢ Drop table student;

25) Delete database.


➢ Drop database student_details;

You might also like