国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

常用的SQL例句 數據庫開發所需知識

2024-07-24 12:49:25
字體:
來源:轉載
供稿:網友
--查看學生表的全部數據
select * from studio
--插入一個新的學生信息
insert into studio(st_name,st_sex,st_age,st_add,st_tel) values("黃蘭淇",0,36,'南充','13943943334')
--查看class全部數據
select * from class
--向class表增加兩條條數據
insert into class(cl_class,cl_coding,cl_o_time,cl_remark) values('新電實訓班','GXA-ncs-001','2008-03-11','都是很優秀的朋友')
insert into class(cl_class,cl_coding,cl_o_time) values('阿壩師專實訓班','GXA-ABSZ-001','2008-03-11')
--更新一條的數據 條件的重要性
update class set cl_remark='真的是不錯' where cl_id=5
--刪除一條數據 條件的重要性
delete from class where cl_id=7
--修改列標題
select cl_id as '班級主鍵',cl_class as '班級名稱' from class
select 名字=st_name from studio
--使用文字串
select '名字是:',st_name from studio
--=============條件稍微復雜點的查增刪改==============
--主要涉及到 or and not between in like > < = !> !< != <> () <= >= is null is not null
--查詢cl_id 大于 1 的所有信息
select * from class where cl_id>1
--使用 or
select * from class where cl_id<>10 or cl_class='百杰一班'
--使用and
select * from class where cl_id<>10 and cl_class='百杰一班'
--使用like 和 %
select * from class where cl_class like '百杰%'
select * from class where cl_remark like '%上午%'
--使用 between
select * from class where cl_id between 3 and 5
--使用 between 配合上 not
select * from class where cl_id not between 3 and 5
--使用 is not null
select * from class where cl_remark is not null
--使用 in
select * from class where cl_class in('千星一班','百杰二班')
--=================使用數學運算符======================
--主要涉及到 + = * /
--查詢Java相關課程分別要上多少周 按照每周5天,每天6節課來計算
select '結果'=co_num/5/6 from course where co_name in ('Java基礎','Java項目入門')
--==================使用匯總函數 ========================
--涉及到COUNT SUM AVG MAX MIN
--查詢課時數小于50的課程一共有多少門
select count(*) from course where co_num<50
--查詢所有課程一共多少課時
select sum(co_num) from course
--計算全部課時費,假設每節課50塊錢
select sum(co_num)*50 from course
--查詢課時最少的課程
select min(co_num) from course
--查詢課時最多的課程
select max(co_num) from course
--查詢平均每門課多少課時
select avg(co_num) from course
--=================使用數學函數=============================
--包括求絕對值函數ABS函數、求圓周率函數PI()、求正玄值SIN()函數、求指數函數EXP()等。
--查詢每門課的正弦值
select sin(co_num) from course
--查詢每門課的絕對值
select abs(co_num) from course
--查詢每門課課時數 乘以 圓周率 ,具體有什么用我也不知道,反正這好像絕對是8.5桿子都打不到的
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 七台河市| 泸州市| 蓬莱市| 乌审旗| 左贡县| 监利县| 宽甸| 岑溪市| 台北县| 大宁县| 龙海市| 平原县| 阳江市| 湘潭县| 上杭县| 封丘县| 苍南县| 杭锦后旗| 德兴市| 久治县| 鹤岗市| 静安区| 长顺县| 平陆县| 睢宁县| 阳江市| 即墨市| 宁都县| 宁海县| 四子王旗| 乌拉特前旗| 繁昌县| 宁波市| 司法| 元阳县| 奉化市| 佳木斯市| 台东县| 兴城市| 凤台县| 原平市|