![7d90f88a1c19e5752a6842094311383e.png](https://img-blog.csdnimg.cn/img_convert/7d90f88a1c19e5752a6842094311383e.png)
SQL系统学习第二课:
一、学习目的:
1.掌握SQL的基本查询语句及指定查询条件语句。
2.学会SQL的两种注释方法。
3.了解SQL语句的书写和运行规则及书写中的注意事项。
4.掌握SQL的几种运算符(算数、比较、逻辑)。
5.掌握字符串的模糊查询(like,%,_)
二、学习工具
1.mysql+navicat+sqlzoo(习题网站)
三、学习框架(思维导图):
![1b26170af1d7231d9146d9068d2326ea.png](https://img-blog.csdnimg.cn/img_convert/1b26170af1d7231d9146d9068d2326ea.png)
四、学习内容:
1.sql的基本查询语句及指定查询条件
1).select子句及from子句:
![22719050fec1843f0f0bb919b8f8e3b0.png](https://img-blog.csdnimg.cn/img_convert/22719050fec1843f0f0bb919b8f8e3b0.png)
2).select子句的三种子句:
![2f6deec0840849ebb2f72a89faea03cc.png](https://img-blog.csdnimg.cn/img_convert/2f6deec0840849ebb2f72a89faea03cc.png)
![f91d522d6073cd0352147b8a11dbdcdc.png](https://img-blog.csdnimg.cn/img_convert/f91d522d6073cd0352147b8a11dbdcdc.png)
![19c562d880819d56c38cca16fc0cead4.png](https://img-blog.csdnimg.cn/img_convert/19c562d880819d56c38cca16fc0cead4.png)
3).where(指定查询条件子句)
![7802b92091d087627fa32a60897da68a.png](https://img-blog.csdnimg.cn/img_convert/7802b92091d087627fa32a60897da68a.png)
2.SQL的两种注释方法
![6cc7b51c38ccd2589350d55ab63a9ddb.png](https://img-blog.csdnimg.cn/img_convert/6cc7b51c38ccd2589350d55ab63a9ddb.png)
为SQL语言写注释是复杂sql语言能够进行交互修改的重要条件。
3.SQL语句的书写和运行规则及书写中的注意事项。
1).sql语句的书写和运行规则。
![1a05a1a3ccb13222a9c7f877dcbb342f.png](https://img-blog.csdnimg.cn/img_convert/1a05a1a3ccb13222a9c7f877dcbb342f.png)
sql书写顺序和运行顺序并不一致,书写1.select,2.from,3where。
运行1.from,2.where,3select。
2).sql语句书写的注意事项。
![a061a4e668cf2256354e628865b8be41.png](https://img-blog.csdnimg.cn/img_convert/a061a4e668cf2256354e628865b8be41.png)
需要特别注意的事项:1.插入表中的数据需要区分大小写。
2..列名不能加单引号,列名命名时不能有空格。
3.子句之间不要空行(间隔行)。
4.子句结尾分号要用英文的,不要用中文的。
4.SQL的几种运算符。
1).算数运算符
![498e09da0380adefbc1ffbf3fd8b1ce5.png](https://img-blog.csdnimg.cn/img_convert/498e09da0380adefbc1ffbf3fd8b1ce5.png)
2).比较运算符
![f47d992a714e4a85e93e58ac05066622.png](https://img-blog.csdnimg.cn/img_convert/f47d992a714e4a85e93e58ac05066622.png)
3).逻辑运算符
![f40a4a65b21826fcbb98e8077a0801fc.png](https://img-blog.csdnimg.cn/img_convert/f40a4a65b21826fcbb98e8077a0801fc.png)
5.字符串的模糊查询
1).like代表字符串的模糊查询
2).%表示任意字符串
![36ed69bd199558e0faee11e42c72a752.png](https://img-blog.csdnimg.cn/img_convert/36ed69bd199558e0faee11e42c72a752.png)
3).一个下划线代表一个字符
![9560c8985deacc6c751e25c69a88e791.png](https://img-blog.csdnimg.cn/img_convert/9560c8985deacc6c751e25c69a88e791.png)
五、sqlzoo练习题记录
1.
![34c4d4bfe0266167876a36075fd448ff.png](https://img-blog.csdnimg.cn/img_convert/34c4d4bfe0266167876a36075fd448ff.png)
![efe52b83880631a5b81d33a627a3677e.png](https://img-blog.csdnimg.cn/img_convert/efe52b83880631a5b81d33a627a3677e.png)
![1f19ab00ce29e72b5e89942a64275985.png](https://img-blog.csdnimg.cn/img_convert/1f19ab00ce29e72b5e89942a64275985.png)
![8e98d1a95fb2abd10729c1b016044e6f.png](https://img-blog.csdnimg.cn/img_convert/8e98d1a95fb2abd10729c1b016044e6f.png)
![922943c02ee708c59e440be3afd36cfb.png](https://img-blog.csdnimg.cn/img_convert/922943c02ee708c59e440be3afd36cfb.png)
2.
![66b00da5c8a84e5a9ee53b9e41c4b84f.png](https://img-blog.csdnimg.cn/img_convert/66b00da5c8a84e5a9ee53b9e41c4b84f.png)
![8427b265778a4de52cd5d86d4a7a5600.png](https://img-blog.csdnimg.cn/img_convert/8427b265778a4de52cd5d86d4a7a5600.png)
![a50b79f323e8a0d65b94d7d948da0e07.png](https://img-blog.csdnimg.cn/img_convert/a50b79f323e8a0d65b94d7d948da0e07.png)
![95186279e8ea6414d9f4a834182cd0a1.png](https://img-blog.csdnimg.cn/img_convert/95186279e8ea6414d9f4a834182cd0a1.png)
![13e0f032860f23055700d8067bb38e5f.png](https://img-blog.csdnimg.cn/img_convert/13e0f032860f23055700d8067bb38e5f.png)
![49e47da3e4ba28c1dc5b74cb925c93f0.png](https://img-blog.csdnimg.cn/img_convert/49e47da3e4ba28c1dc5b74cb925c93f0.png)
![a668f99557a17884aa7720f38f578a45.png](https://img-blog.csdnimg.cn/img_convert/a668f99557a17884aa7720f38f578a45.png)
![6631cc925b6d08bd32b0aed57031b923.png](https://img-blog.csdnimg.cn/img_convert/6631cc925b6d08bd32b0aed57031b923.png)
![5286060bee02ffc82023e6c4724aa192.png](https://img-blog.csdnimg.cn/img_convert/5286060bee02ffc82023e6c4724aa192.png)
六:学习小结:
通过课程学习,掌握了sql基本查询语句及指定查询条件的语句,学会了两种语句注释方式。
了解了SQL语句的书写和运行规则,掌握sql语句书写中的相关注意事项。
掌握了SQL的几种运算符(算数、比较、逻辑)及模糊查询的方法,并在练习题中得到实践。