Bài tập cơ sở dữ liệu

19 157 0
Bài tập cơ sở dữ liệu

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Bài tập sở liệu Cho sở liệu TUYENSINH.MDB, thực câu Select Query sau: Liệt kê danh sách thí sinh đăng ký dự thi SELECT DSThiSinh.* FROM DSThiSinh; Liệt kê danh sách ngành điểm chuẩn select tennganh,diemchuan from nganh; Liệt kê danh sách thí sinh đăng ký dự thi tên bắt đầu ký tự R K select dsthisinh.* from dsthisinh where left(ten,1) in ("R","K"); Liệt kê danh sách thí sinh đăng ký dự thi họ lót Phan tên Hoa, Dung Nga select dsthisinh.* from dsthisinh where (left(holot,4) = "phan") and (ten in ("hoa","dung","nga")); Liệt kê danh sách thí sinh đăng ký dự thi thoả yêu cầu sau:  họ lót Phan  tên Hoa, Dung Nga  mã tỉnh select dsthisinh.* from dsthisinh where (left(holot,4)="phan")and(ten in ("hoa","dung","nga"))and(matinh=2); Liệt kê danh sách thí sinh đăng ký dự thi thoả yêu cầu sau:  Phái nữ  Nguyện vọng ngành mã 410  Sắp xếp theo tên select dsthisinh.* from dsthisinh where (phainam=false)and(nganh="410") Baøi tập sở liệu order by ten; Liệt kê danh sách thí sinh điểm thi mơn tốn từ đến select dsthisinh.* from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where toan between and 9; Liệt kê danh sách thí sinh điểm thi mơn tốn từ đến thưởng select dsthisinh.* from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (toan between and 9)and (thuong=2); Cho biêt thông tin SBD, Ho, Tên, điểm thí sinh tổng điểm khoảng từ X đến Y (tuỳ ý ) Select dsthisinh.* From dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd Where (toan+ly+hoa+thuong) between X and Y; 10 Liệt kê danh sách thí sinh điểm tổng cộng >= 25 theo thứ tự điểm tổng cộng giảm dần select dsthisinh.* from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (toan+ly+hoa)>=25 order by (toan+ly+hoa) desc; 11 Liệt kê danh sách thí sinh nữ thi vào ngành số “410” hoặc”405” điểm tổng cộng >=25 select dsthisinh.* from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (phainam=false) and (nganh in ("410","405")) and ((toan+ly+hoa)>=25); 12 Cho biết điểm thi nhỏ khác mơn Tốn, Lí, Hố select min(a) as minT,min(b) as minL,min(c) as minH from (select iif(toan=0,11,toan) as a,iif(ly=0,11,ly) as b,iif(hoa=0,11,hoa) as c from ketqua); 13 Cho biết SBD, HoLot, Ten thí sinh môn thi bị điểm select dsthisinh.sbd,holot,ten from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (toan*ly*hoa)0; 14 Cho biết SBD, HoLot, Ten thí sinh ba mơn thi bị điểm Bài tập sở liệu select dsthisinh.sbd,holot,ten from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (toan=0)and(ly=0)and(hoa=0); 15 Cho biết SBD, HoLot, Ten thí sinh mơn thi bị điểm select dsthisinh.sbd,holot,ten from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where ((toan=0)and(ly0)and(hoa0))or((toan0)and(ly=0)and(hoa0))or((toan0)and (ly0)and(hoa=0)); 16 Cho biết điểm trung bình mơn Tốn, Lí, Hố tất thí sinh khơng bị điểm mơn select dsthisinh.*,(toan+ly+hoa)/3 as diemtb from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where toan*ly*hoa0; 17 Đếm số thí sinh (Nam/Nữ) đăng kí dự thi select count(a) as sonam,count(b) as sonu from (select iif(phainam=true,1,null)as a,iif(phainam=false,1,null) as b from dsthisinh); 18 Đếm số thí sinh (Nam/Nữ ) đăng ký dự thi theo tỉnh thành select tennganh,count(a) as sonam,count(b) as sonu from (select iif(phainam=true,1,null)as a,iif(phainam=false,1,null) as b,tennganh from dsthisinh inner join nganh on dsthisinh.nganh=nganh.manganh) group by tennganh; 19 Đếm số thí sinh (Nam/Nữ ) đăng ký dự thi theo tỉnh thành theo mã ngành đăng kí nguyện vọng select nganh,tennganh,count(a) as sonam,count(b) as sonu from (select iif(phainam=true,1,null)as a,iif(phainam=false,1,null) as b,tennganh,dsthisinh.nganh from dsthisinh inner join nganh on dsthisinh.nganh=nganh.manganh) group by nganh,tennganh; 20 Liệt kê danh sách Tỉnh thí sinh đăng ký dự thi select tentinh from tinhthanh where matinh in (select matinh Baøi tập sở liệu from dsthisinh); 21 Liệt kê danh sách Tỉnh khơng thí sinh đăng ký dự thi select tentinh from tinhthanh where matinh not in (select matinh from dsthisinh); 22 Cho biết ngành điểm chuẩn cao select tennganh from nganh where diemchuan in (select max(diemchuan) as maxdiemchuan from nganh); 23 24 Cho biết số báo danh họ tên thí sinh điểm thi mơn Tốn cao select dsthisinh.sbd,holot,ten,toan from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where toan in (select max(toan) as maxtoan from ketqua); 25 Cho biết họ tên thí sinh nhỏ tuổi select holot,ten,ngaysinh from dsthisinh where ngaysinh in (select max(ngaysinh) as a from dsthisinh); 26 Cho biết họ tên điểm mơn thí sinh tổng điểm cao select holot,ten,toan,ly,hoa from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (toan+ly+hoa) in (select max(toan+ly+hoa) as maxtongdiem from ketqua); 27 Cho biết thông tin SBD, Họ tên, điểm thi thí sinh trúng tuyển nguyện vọng select dsthisinh.sbd,holot,ten,toan,ly,hoa from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan; 28 Cho biết thí sinh đậu nguyện vọng select count(dsthisinh.sbd) as sothisinh Baøi tập sở liệu from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan; 29 Cho biết tổng thí sinh trúng tuyển nguyện vọng ngành select nganh.manganh,tennganh,count(dsthisinh.sbd) as sothisinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan group by manganh,tennganh; 30 Liệt kê danh sách Tỉnh thí sinh trúng tuyển nguyện vọng select tentinh from tinhthanh where matinh in (select matinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan); 31 Liệt kê danh sách Tỉnh thí sinh đậu nguyện vọng vào nghành 401 select tentinh from tinhthanh where matinh in (select matinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where ((toan+ly+hoa+thuong)>=diemchuan)and (nganh = "401")); 32 Cho biết thông tin thí sinh trúng tuyển nguyện vọng vào nghành N( với N tham số người sử dụng nhập vào) select tentinh from tinhthanh where matinh in (select matinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where ((toan+ly+hoa+thuong)>=diemchuan)and (nganh = "N")); 33 Đếm số thí sinh trúng tuyển nguyện vọng theo ngành tỉnh select tentinh,tennganh,count(dsthisinh.sbd) as sothisinh Baøi tập sở liệu from tinhthanh inner join (nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh) on dsthisinh.matinh=tinhthanh.matinh where (toan+ly+hoa+thuong)>=diemchuan group by tentinh,tennganh; 34 Liệt kê sbd, hoten, diem tong cong, diem chuan kết đậu/ rớt thí sinh đăng ký nguyện vọng vào nghành Kế Toán – Kiểm Toán select dsthisinh.sbd,holot,ten,(toan+ly+hoa+thuong) as tongdiem,diemchuan,iif((toan+ly+hoa+thuong)>=diemchuan,"dau","rot") as ketqua from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where tennganh="KẾ TỐN-KIỂM TỐN"; 35 Cho biết tổng số thí sinh đậu nguyện vọng ngành tổng số thí sinh đậu vượt tiêu select sum(sothisinh) as sots from (select tennganh,chitieu,count(dsthisinh.sbd) as sothisinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan group by tennganh,chitieu) where sothisinh>chitieu; 36 Đếm số thí sinh khơng trúng tuyển nguyện vọng trúng tuyển nguyện vọng 2, biết điểm trúng tuyển nguyện vọng cao điểm trúng tuyển nguyện vọng điểm select count(dsthisinh.sbd) as sothisinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh2 where ((toan+ly+hoa+thuong)>=diemchuan+2)and(dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)); Baøi tập sở liệu 37 Đếm số thí sinh khơng trúng tuyển nguyện vọng trúng tuyển nguyện vọng theo mã ngành, biết điểm trúng tuyển nguyện vọng cao điểm trúng tuyển nguyện vọng điểm select tennganh,count(dsthisinh.sbd) as sothisinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh2 where ((toan+ly+hoa+thuong)>=diemchuan+2)and(dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)) group by tennganh; 38 Đếm số thí sinh khơng trúng tuyển nguyện vọng trúng tuyển nguyện vọng theo mã ngành theo tỉnh thành, biết điểm trúng tuyển nguyện vọng cao điểm trúng tuyển nguyện vọng điểm select tentinh,tennganh,count(dsthisinh.sbd) as sothisinh from tinhthanh inner join (nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh2) on tinhthanh.matinh=dsthisinh.matinh where ((toan+ly+hoa+thuong)>=diemchuan+2)and(dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)) group by tentinh,tennganh; 39 Đếm số thí sinh khơng trúng tuyển nguyện vọng nguyện vọng select count(dsthisinh.sbd) as sotskhongdau from dsthisinh where dsthisinh.sbd not in (select dsthisinh.sbd from tinhthanh inner join (nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh2) on tinhthanh.matinh=dsthisinh.matinh where ((toan+ly+hoa+thuong)>=diemchuan+2)and(dsthisinh.sbd not in (select dsthisinh.sbd Baøi tập sở liệu from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)))and(dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)); 40 Đếm số thí sinh khơng trúng tuyển nguyện vọng nguyện vọng theo tỉnh thành select tentinh,tennganh,count(dsthisinh.sbd) as sotskhongdau from tinhthanh inner join (dsthisinh inner join nganh on dsthisinh.nganh=nganh.manganh) on tinhthanh.matinh=dsthisinh.matinh where dsthisinh.sbd not in (select dsthisinh.sbd from tinhthanh inner join (nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh2) on tinhthanh.matinh=dsthisinh.matinh where ((toan+ly+hoa+thuong)>=diemchuan+2)and(dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)))and(dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan)) group by tentinh,tennganh; 41 Cho biết thủ khoa tỉnh 42 Cho biết thủ khoa ngành NGÂN HÀNG CÁC CÂU SQL Tìm tất TS nam họ Phan, tên Trung, sinh vào ngày 23/5 ( theo mẫu ) select sbd,holot,ten from dsthisinh where(phainam=true)and(left(holot,4)="phan")and(ten="trung")and(day(ngaysinh)=23)an d (month(ngaysinh)=5); Baøi tập sở liệu Tìm MaNganh TenNganh ngành tiêu cao select manganh,tennganh,chitieu from nganh where chitieu in (select max(chitieu) as maxchitieu from nganh); Tìm MaNganh TenNganh ngành điểm chuẩn cao select manganh,tennganh,diemchuan from nganh where diemchuan in (select max(diemchuan) as maxdiemchuan from nganh); Tìm tất TS nữ thi vào ngành 410, tên bắt đầu chữ A select dsthisinh.* from dsthisinh where (phainam=false)and(nganh="410")and(left(ten,1)="a"); Tìm tất TS thi vào ngành 410 ngành 408, tổng điểm ba môn thi khoảng từ 25 đến 29 điểm select dsthisinh.* from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (nganh in ("410","408"))and((toan+ly+hoa) between 25 and 29); Tìm tất TS nữ, họ Nguyễn, tên Minh Nga, sinh năm 1983 select dsthisinh.* from dsthisinh where (phainam=false)and(left(holot,6)="nguyen")and(ten in ("minh","nga"))and(year(ngaysinh)=1983); Tìm tất TS thi vào ngành 410, điểm tổng cộng ba mơn thi  27 select dsthisinh.* from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (nganh="410")and((toan+ly+hoa)>=27); Cho biết ngành số TS đăng ký dự thi đông select top tennganh,count(dsthisinh.sbd) as sothisinh from dsthisinh inner join nganh on dsthisinh.nganh=nganh.manganh group by tennganh order by count(dsthisinh.sbd) desc; Cho biết tỉnh thành TS thi vào ngành 410 Bài tập sở liệu select tentinh from tinhthanh where matinh in (select matinh from dsthisinh where nganh="410"); 10 Cho biết tỉnh thành TS đăng ký dự thi select tentinh from tinhthanh where matinh in (select matinh from dsthisinh) 11 Cho biết tỉnh thành khơng TS đăng ký dự thi select tentinh from tinhthanh where matinh not in (select matinh from dsthisinh) 12 Cho biết tỉnh thành nhiều TS đăng ký dự thi nhất, ngoại trừ TpHCM select top tentinh,count(sbd) as sothisinh from dsthisinh inner join tinhthanh on dsthisinh.matinh=tinhthanh.matinh where dsthisinh.matinh group by tentinh order by count(sbd) desc; 13 Cho biết tỉnh thành nhiều TS thi vào ngành 410 nhất, ngoại trừ TpHCM select top tentinh,count(sbd) as sothisinh from dsthisinh inner join tinhthanh on dsthisinh.matinh=tinhthanh.matinh where (dsthisinh.matinh 2)and(nganh="410") group by tentinh order by count(sbd) desc; 14 TS không thuộc đối tượng ưu tiên ? select ((count(sbd))-(count(doituong))) as khonguutien from dsthisinh; 15 TS không đăng ký nguyện vọng ? select ((count(sbd))-(count(nganh2))) as khongnganh2 from dsthisinh; 16 TS TpHCM khơng đăng ký nguyện vọng vào 410 Bài tập sở liệu 10 select ((count(sbd))-(count(nganh2))) as khongnganh2 from dsthisinh where (matinh=2)and(nganh="410"); 17 loại đối tượng ưu tiên ? select count(doituong) as sodoituong from (select doituong from dsthisinh group by doituong); 18 tỉnh thành TS đăng ký dự thi ? select count(matinh) as sotinhthanh from (select matinh from dsthisinh group by matinh); 19 tỉnh thành khơng TS đăng ký dự thi ? select count(matinh) as sotinhkhongthisinh from tinhthanh where matinh not in (select matinh from dsthisinh); 20 TS điểm thi mơn tốn  ? select count(sbd) as sothisinh from ketqua where toan>=9; 21 TS xếp vào hệ Dự Bị, biết để vào hệ Dự Bị phải không trúng tuyển nguyện vọng lẫn nguyện vọng 2, ngồi tổng điểm mơn thi phải  15 khơng điểm mơn thi select count(dsthisinh.sbd) as sothisinh from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd where (dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh2=nganh.manganh where (dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh=nganh.manganh where (toan+ly+hoa+thuong)>=diemchuan)) and ((toan+ly+hoa+thuong)>=diemchuan+2))) and (dsthisinh.sbd not in (select dsthisinh.sbd Baøi tập sở liệu 11 from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh=nganh.manganh where (toan+ly+hoa+thuong)>=diemchuan))and((toan+ly+hoa)>=15)and(toan0)and(ly0)and (hoa0); 22 TS khơng bị điểm môn thi ? select count(sbd) as sothisinh from ketqua where (toan0)and(ly0)and(hoa0); 23 TS bị điểm mơn thi ? select count(sbd) as sothisinh from ketqua where sbd not in (select sbd from ketqua where (toan=0)and(ly=0)and(hoa=0)); 24 TS bỏ thi mơn tốn ? select count(a) as sotsbothitoan from (select iif(toan=0,1,null) as a from ketqua); 25 TS bỏ thi môn lý ? select count(a) as sotsbothily from (select iif(ly=0,1,null) as a from ketqua); 26 TS bỏ thi mơn hóa ? select count(a) as sotsbothihoa from (select iif(hoa=0,1,null) as a from ketqua); 27 TS bỏ thi mơn ? select count(sbd) as sothisinh from ketqua where sbd not in (select sbd from ketqua where (toan=0)and(ly=0)and(hoa=0)); 28 TS khơng trúng tuyển nguyện vọng ? Bài tập sở liệu 12 select count(sbd) as sothisinh from dsthisinh where sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan); 29 TS khơng trúng tuyển nguyện vọng ? select count(sbd) as sothisinh from dsthisinh where sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh where (toan+ly+hoa+thuong)>=diemchuan); 30 TS khơng trúng tuyển nguyện vọng lẫn nguyện vọng ? select count(sbd) as sothisinh from dsthisinh where (sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh2=nganh.manganh where (dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh=nganh.manganh where (toan+ly+hoa+thuong)>=diemchuan)) and ((toan+ly+hoa+thuong)>=diemchuan+2))) and (sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh=nganh.manganh where (toan+ly+hoa+thuong)>=diemchuan)) 31 TS trúng tuyển nguyện vọng không trúng tuyển nguyện vọng ? select count(dsthisinh.sbd) as sothisinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh2=nganh.manganh where (dsthisinh.sbd not in (select dsthisinh.sbd from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh=nganh.manganh where (toan+ly+hoa+thuong)>=diemchuan)) and ((toan+ly+hoa+thuong)>=(diemchuan+2)); 32 TS thủ khoa ? Baøi tập sở liệu 13 select count(matinh) as sothisinh from (select matinh,max(toan+ly+hoa+thuong) as maxtongdiem from dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd group by matinh); 33 quận/huyện TpHCM TS đăng ký dự thi ? select count(mahuyen) as sohuyen from (select mahuyen from dsthisinh where matinh=2 group by mahuyen); 34 TS khơng điểm thưởng thi đậu ? select count(dsthisinh.sbd) as sothisinh from nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on dsthisinh.nganh=nganh.manganh where (toan+ly+hoa)>=diemchuan; 35 mức điểm thưởng khác ? select count(thuong) as somucthuong from (select thuong from ketqua group by thuong); 36 TS khơng điểm thưởng ? select count(a) as sothisinh from (select iif(thuong=0,1,null) as a from ketqua); 37 Hỏi điểm toán cao ? select max(toan) as maxtoan from ketqua; 38 Hỏi tổng điểm ba môn cao ? select max(toan+ly+hoa) as maxtongdiem from ketqua; 39 Thống kê số TS theo giới tính theo đơn vị tỉnh thành ( theo mẫu ) select matinh,tentinh,count(a) as sonam,count(b) as sonu from (select iif(phainam=true,1,null) as a,iif(phainam=false,1,null)as b,dsthisinh.matinh,tentinh from dsthisinh inner join tinhthanh on dsthisinh.matinh=tinhthanh.matinh) Baøi tập sở liệu 14 group by matinh,tentinh; 40 Thống kê số TS trúng tuyển nguyện vọng 1, theo tỉnh ngành ( theo mẫu ) select tentinh,tennganh,count(dsthisinh.sbd) as sothisinh from tinhthanh inner join (nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh) on dsthisinh.matinh=tinhthanh.matinh where (toan+ly+hoa+thuong)>=diemchuan group by tentinh,tennganh; 41 Thống kê số TS nam, số TS nữ đăng ký dự thi, theo ngành select tennganh,count(a) as sonam,count(b) as sonu from (select iif(phainam=true,1,null) as a,iif(phainam=false,1,null) as b,tennganh from dsthisinh inner join nganh on dsthisinh.nganh=nganh.manganh) group by tennganh; 42 Cho biết tỉnh thành TS đăng ký dự thi vào ngành 410 43 Cho biết tỉnh thành TS thi đậu vào ngành 410 ? 44 Cho biết tỉnh thành số TS thi đậu cao nhất, ngoại trừ TpHCM 45 Cho biết ngành số TS thi đậu vượt 80% tiêu select top tennganh,iif((sothisinh/chitieu)>0.8,true,false) as vuot80 from (select tennganh,chitieu,count(dsthisinh.sbd) as sothisinh from tinhthanh inner join (nganh inner join (dsthisinh inner join ketqua on dsthisinh.sbd=ketqua.sbd) on nganh.manganh=dsthisinh.nganh) on dsthisinh.matinh=tinhthanh.matinh where (toan+ly+hoa+thuong)>=diemchuan group by tennganh,chitieu) order by iif((sothisinh/chitieu)>0.8,true,false) ; 46 Cho biết ngành điểm chuẩn thấp 15 điểm 47 Cho biết hệ số chọi ngành 48 Cho biết số TS thi đậu số TS thi rớt ngành 49 Cho biết tỷ lệ thi đậu nam, tỷ lệ thi đậu nữ 50 Cho biết tỷ lệ thi đậu nam, tỷ lệ thi đậu nữ ngành 51 Cho biết tỉnh thành TS đăng ký dự thi không đậu vào nguyện vọng 52 Cho biết SBD, họ tên tổng điểm ba môn thi TS thủ khoa 53 Cho biết điểm thủ khoa số TS thủ khoa ngành 54 Cho biết tỉnh thành nhiều quận/huyện TS đăng ký dự thi nhất, ngoại trừ TpHCM Baøi tập sở liệu 15 55 Lập danh sách TS cột kết mơn thi, cột điểm tổng cộng ba môn thi, theo mẫu 56 Lập danh sách TS thi đậu vào ngành 410, theo mẫu Đề thi Tiền Giang Câu I A Sử dụng câu SQL thích hợp để thực yêu cầu sau  Lập danh sách tất TS thi đậu vào ngành 410, theo mẫu Trong đó, TONGDIEM tổng điểm ba mơn thi  Lập danh sách tất TS, theo mẫu Baøi tập sở liệu 16 Trong đó, TONGDIEM tổng điểm ba môn thi  Liệt kê tất ngành điểm chuẩn thấp 15 điểm, theo mẫu  Thống kê số TS theo giới tính theo đơn vị tỉnh thành tỉnh thành TS đăng ký dự thi, theo mẫu  Lập danh sách tất TS Tiền Giang ( mã tỉnh = 53 ) , theo mẫu Baøi tập sở liệu 17 B Sử dụng câu SQL thích hợp để trả lời số câu hỏi Mỗi câu hỏi câu trả lời, câu trả lời Anh ( chị ) đánh dấu  vào câu trả lời mà anh ( chị ) cho  TS khơng thuộc đối tượng ưu tiên ? ( HD: DOITUONG IS NULL )  TS nam ?  tỉnh thành khơng TS đăng ký dự thi ?  TS điểm thi mơn tốn  ?  quận/huyện TpHCM TS đăng ký dự thi ?  Cho biết mức cao tổng điểm ba môn thi ?  TS khơng điểm thưởng ? ( HD: THUONG = )  TS trúng tuyển nguyện vọng ?  TS TpHCM khơng đăng ký nguyện vọng vào ngành 410  Cho biết ngành số TS đăng ký dự thi đơng Đề dự phòng  Cho biết tỉnh thành nhiều TS đăng ký dự thi nhất, ngoại trừ TpHCM  Cho biết tỉnh thành nhiều TS thi vào ngành 410 nhất, ngoại trừ TpHCM  TS không đăng ký nguyện vọng ?  tỉnh thành TS đăng ký dự thi ?  Thống kê số TS trúng tuyển nguyện vọng 1, theo tỉnh ngành ( theo mẫu )  Cho biết tỉnh thành TS thi đậu vào ngành 410 ? Baøi tập sở liệu 18  Cho biết tỉnh thành số TS thi đậu cao nhất, ngoại trừ TpHCM.(tn)  Cho biết số TS thi đậu số TS thi rớt ngành 410 (tn)  Cho biết tỷ lệ thi đậu nam, tỷ lệ thi đậu nữ (tn) Baøi tập sở liệu 19 ... where(phainam=true)and(left(holot,4)="phan")and(ten="trung")and(day(ngaysinh)=23)an d (month(ngaysinh)=5); Bài tập Cơ sở liệu Tìm MaNganh TenNganh ngành có tiêu cao select manganh,tennganh,chitieu from nganh where... tennganh order by count(dsthisinh.sbd) desc; Cho biết tỉnh thành có TS thi vào ngành 410 Bài tập Cơ sở liệu select tentinh from tinhthanh where matinh in (select matinh from dsthisinh where nganh="410");... from ketqua where (toan=0)and(ly=0)and(hoa=0)); 28 Có TS khơng trúng tuyển nguyện vọng ? Bài tập Cơ sở liệu 12 select count(sbd) as sothisinh from dsthisinh where sbd not in (select dsthisinh.sbd

Ngày đăng: 07/11/2017, 10:49

Tài liệu cùng người dùng

  • Đang cập nhật ...