-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpracticeII.sql
More file actions
26 lines (20 loc) · 787 Bytes
/
practiceII.sql
File metadata and controls
26 lines (20 loc) · 787 Bytes
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
create database if not exists db1;
use db1;
create table if not exists table1(
id int primary key,
name varchar(20) not null,
employment bool,
gender varchar(10) default 'Male');
insert into table1 values(101, 'Abhishek Kumar', 0, 'Male'), (102, 'Himanshu Kumar', 1, 'Male'), (103, 'Girl', 1, 'Female');
select * from table1;
alter table table1 rename column employment to employ;
alter table table1 add column marks int default 0;
alter table table1 drop column employ;
alter table table1 add column status varchar(20) default 'Done' after id;
update table1 set status='Not Done' where id=101;
update table1 set marks=100 where id=101;
update table1 set marks=100 where name like 'H%';
delete from table1 where id=103;
delete from table1;
truncate table table1;
drop table table1;