0% found this document useful (0 votes)
8 views

Create Database Database

This document contains SQL statements to create and query a database table. It creates a table with fields for ID, name, and class. It inserts a sample record and performs various select statements to retrieve data based on filters, joins, limits, and comparisons on the table fields. The select statements include filtering by qualifications, branches, marks ranges, using IN, BETWEEN, LIKE, JOIN, and other SQL clauses.

Uploaded by

ABC
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Create Database Database

This document contains SQL statements to create and query a database table. It creates a table with fields for ID, name, and class. It inserts a sample record and performs various select statements to retrieve data based on filters, joins, limits, and comparisons on the table fields. The select statements include filtering by qualifications, branches, marks ranges, using IN, BETWEEN, LIKE, JOIN, and other SQL clauses.

Uploaded by

ABC
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Create database Database_name;


2. Use Database_name;
3. create table Table _name (fid int , Fname varchar(100), Class varchar(50));
4. insert into Table _name values (1,’kumar’, ‘Diploma’);
5. select * from Table _name;
6. select distinct faname from Table _name;
7. select fid, fname from Table _name where qualification='B.tech';
8. select * from Table _name where qualification !=’B.tech’;
9. select sname from student where branch='computer' and marks <70;
10. select sname from student where branch='computer' or branch='IT';
11. select fname from faculty where deptid IN (1,3);
12. select * from faculty where qualification IN (‘B. tech’,’M.tech’);
13. select * from student where branch NOT IN(‘it’,’CSE’);
14. select * from student where marks between 60 and 90;
15. select * from student where marks NOT between 70 and 90;
16. select * from faculty Limit 2;
17. select * from faculty Limit 4,5;
18. select * from faculty where Fname Like ‘A%’;
19. order by
20. field()
21. select * from faculty Cross Join department;
22. select * from faculty Cross Join department where department.deptid=1;
23. select f.fname,d.deptname from faculty f INNER JOIN department d ON f.deptid = deptid;
24. select f.fname,d.deptname from faculty f INNER JOIN department d ON f.deptid = deptid where
d.deptid=2;
25. select f.fname,d.deptname from faculty f LEFT JOIN department d ON f.deptid = deptid;
26. select f.fname,d.deptname from faculty f RIGHT JOIN department d ON f.deptid = deptid;
27.

You might also like