SQL Practical File
SQL Practical File
3. Create a student table with the student id, class, section, gender, name, dob,
and marks as attributes where the student id is the primary key.
create table student
(studentid int(4) primary key,
class char(2),
section char(1),
gender char(1),
name varchar(20),
dob date,
marks decimal(5,2));
12. Find the number of students, who are from section ‘A’.
alter table student add column email varchar(20);
15. Display the information of all the students, name contains ‘sh’
select * from student where name like 'sh%';
16. Display the information of all the students, name starts with ‘sh’
select * from stduent where name like 'sh%';
19. Display stduentid, Gender, Name, DOB, Marks, Email in descending order of
their marks.
select studentid, gender, name, dob, marks, email from student
orderby marks desc;