-
Notifications
You must be signed in to change notification settings - Fork 1
/
p2.sql
54 lines (43 loc) · 2.1 KB
/
p2.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.open kc.db
drop table if exists student;
create table if not exists student
(
rno int primary key not null,
name text not null,
marks int check (marks >= 0 and marks <= 100),
tel varchar(10),
email varchar(50),
location text default 'mumbai',
gender char(1),
dept text not null
);
insert into student values(10, 'amit', 89, '6677', null, 'mumbai', 'm' , 'comps');
insert into student values(11, 'sumit', 67, '6667', '[email protected]', 'thane', 'm' , 'extc');
insert into student values(12, 'ramit', 78, '6667', '[email protected]', 'mumbai', 'm' , 'comps');
insert into student values(13, 'namit', 89, '9967', '[email protected]', 'thane', 'm' , 'extc');
insert into student values(14, 'mit', 76, '967', '[email protected]', 'mumbai', 'm' , 'comps');
insert into student values(15, 'seema', 79, '867', '[email protected]', 'mumbai', 'f' , 'extc');
insert into student values(16, 'reema', 78, '767', null, 'thane', 'm' , 'comps');
insert into student values(17, 'jyoti', 89, '567', '[email protected]', 'mumbai', 'f' , 'extc');
insert into student values(18, 'pooja', 89, '467', null, 'thane', 'f' , 'comps');
insert into student values(19, 'aarti', 91, '367', '[email protected]', 'mumbai', 'f' , 'extc');
insert into student values(20, 'divya', 93, '467', '[email protected]', 'mumbai', 'f' , 'comps');
select * from student;
.header on
select rno, name from student;
select name, marks from student;
select name || "has secured" || marks || 'marks' from student;
select name || "has secured" || marks || 'marks' as info from student;
select location from student;
select all location from student;
select distinct location from student;
--find all student from 'mumbai';
select * student from where location = 'mumbai';
select * student from where dept = 'extc';
select * student from where email is NULL;
select * from student where marks >= 40 and marks <= 80;
select * from student where marks between 40 and 80;
select * from student where rno == 13 or rno == 19 or rno == 16;
select * from student where rno in (13,19,16);
SELECT * FROM STUDENT WHERE NAME LIKE '%IT%';
SELECT * FROM STUDENT WHERE NAME LIKE 'A%';