-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay1.sql
More file actions
executable file
·88 lines (39 loc) · 1.32 KB
/
Day1.sql
File metadata and controls
executable file
·88 lines (39 loc) · 1.32 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
create table tb (
id int(10) auto_increment,
name text not null,
gender text not null,
primary key (id)
);
insert into tb (name ,gender) values ("brahma","M"), ("para","F"),("trilochana","M"),("bhagyarathi","M"),("Basanti kar ","M");
select * from tb;
select id as kk from tb;
update tb set gender="F" where id =5;
select * from tb group by gender ;
select name ,case when gender="M" then "F"
when gender="F" then "M"
else "not defined"
end as sex from tb;
set @kk=(select name ,case when gender="M" then "F"
when gender="F" then "M"
else "not defined"
end as sex from tb);
select name into @ss from tb where id=2;
select @ss;
select "commint" into @so;
select @para;
insert into tb1(name,gender) value ("lipu",1),("lipu2",2),("lipu3",2),("lipu4",1),("lipu5",2);
insert into tb2 (idtb2,gen) values (1,"male"),(2,"female");
insert into tb2 (idtb2,gen) values (3,"transgender");
select * from tb2;
delete from tb2 where gen="male";
create index ind4 on tb1 (gender);
show index from tb1;
drop index ind4 on tb1;
# creating strored procedure
drop procedure if exists hello;
delimiter //
create procedure hello(in ss varchar(222))
begin
select * from tb1 where name =ss;
end //
call hello("lipu2");