By GokiSoft.com|
14:43 27/11/2020|
SQL Server/MySQL
[Share Code] Bài giảng T2008A - Lập trình SQL Server
select * from category
-- Sua table: Lap Trinh JS => Lap Trinh HTML/CSS/JS
update category set name = 'Lap Trinh HTML/CSS/JS'
where name = 'Lap Trinh JS'
update category set name = 'TEST' where name like '%Trinh%'
update category set name = 'Lap Trinh C' where id = 1
update category set name = 'Lap Trinh HTML/CSS/JS' where id = 3
delete from category
select * from student2
update student2 set rollno = 'R000' where rollno = ''
delete from student2 where rollno = 'R003'
alter table student2
add email nvarchar(150)
update student2 set email = 'gokisoft.com@gmail.com'
update student2 set email = null
alter table student2
add constraint unique_email unique (email)
select top(2) * from student2
select distinct firstname, lastname, address from student2
select firstname, lastname, address, count(firstname) as count_total
from student2
group by firstname, lastname, address
having count(firstname) > 1
order by count_total asc
alter table student2
add age int default 18
select firstname, lastname, address, avg(age) as avg_age
from student2
group by firstname, lastname, address
select firstname, lastname, address, sum(age) as sum_age
from student2
group by firstname, lastname, address
select firstname, lastname, address, min(age) as min_age
from student2
group by firstname, lastname, address
select firstname, lastname, address, max(age) as max_age
from student2
group by firstname, lastname, address
select firstname, lastname,address, age as 'Tuoi' from student2
where age <=19
order by 'Tuoi' asc
union
select firstname, lastname,address, age 'Tuoi' from student2
where age > 19
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)