![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
mysql
mysql 操作
不期而遇、
这个作者很懒,什么都没留下…
展开
-
sqlzoo-Self JOIN
9. Self JOIN 自我合并How many stops are in the database.select count(*) from stops;Find the id value for the stop ‘Craiglockhart’select id from stops where name='Craiglockhart';Give the id and...原创 2020-05-05 11:00:51 · 262 阅读 · 0 评论 -
sqlzoo-Using NULL
8. Using NULL 空值使用List the teachers who have NULL for their department.select name from teacher where dept is null;Note the INNER JOIN misses the teachers with no department and the departments...原创 2020-05-05 10:58:50 · 180 阅读 · 0 评论 -
sqlzoo-More JOIN
7. More JOIN 更多合并操作列出1962年首影的電影, [顯示 id, title]select id, title from movie where yr=1962;電影大國民 ‘Citizen Kane’ 的首影年份。select yr from movie where title ='Citizen Kane';列出全部Star Trek星空奇遇記系列的電影...原创 2020-05-05 10:57:50 · 345 阅读 · 0 评论 -
sqlzoo-join
6. JOIN 合并两个表格列出 賽事編號**matchid 和球員名player **,該球員代表德國隊Germany入球的。要找出德國隊球員,要檢查: teamid = 'GER'select matchid, player from goal where teamid = 'GER';只顯示賽事1012的 id, stadium, team1, team2SELECT id...原创 2020-05-05 10:56:13 · 425 阅读 · 0 评论 -
sqlzoo-SUM and COUNT
5.SUM and COUNT 群组函数展示世界的总人口select sum(population) from world;列出所有的洲份, 每個只有一次。select distinct(continent) from world;找出非洲(Africa)的GDP總和。select sum(gdp) from world where continent = 'Afri...原创 2020-05-05 10:53:00 · 265 阅读 · 0 评论 -
sqlzoo-SELECT within SELECT
4. SELECT within SELECT 子查询列出每個國家的名字 name,當中人口 population 是高於俄羅斯’Russia’的人口。select name from world where population > (select population from world where name = 'Russia');列出歐州每國家的人均GDP,當中人均G...原创 2020-05-05 10:47:29 · 604 阅读 · 0 评论 -
sqlzoo-select from nobel
3. SELECT from Nobel更改显示的查询,以显示1950年的诺贝尔奖。 select yr, subject, winner from nobel where yr = 1950;顯示誰贏得了1962年文學獎(Literature)。select winner from nobel where yr = 1962 and subject = 'Literature'...原创 2020-05-05 10:44:07 · 448 阅读 · 0 评论 -
sqlzoo-select from world
2. select from world觀察運行一個簡單的SQL命令的結果。select name, continent, population from world;顯示具有至少2億人口的國家名稱。 2億是200000000,有八個零。select name from world where population > 200000000;找出有至少200百萬(2億...原创 2020-05-05 10:39:48 · 444 阅读 · 1 评论 -
sqlzoo-select names
1. select names 文字样式匹配找出以 Y 為開首的國家。 select name from world where name like 'Y%';找出以 Y 為結尾的國家。select name from world where name like '%Y'找出所有國家,其名字包括字母x。select name from world where name ...原创 2020-05-05 10:30:46 · 300 阅读 · 0 评论 -
sqlzoo-select basics
0. select basics 基础這個例子顯示’France法國’的人口。字串應該在’單引號’中。修改此例子,以顯示德國 Germany 的人口。SELECT population FROM world WHERE name = 'Germany'查詢顯示面積為 5,000,000 以上平方公里的國家,該國家的人口密度(population/area)。人口密度並不是 WOR...原创 2020-05-05 10:10:06 · 215 阅读 · 0 评论 -
sqlzoo-答案全集-亲测
0. select basics 基础這個例子顯示’France法國’的人口。字串應該在’單引號’中。修改此例子,以顯示德國 Germany 的人口。SELECT population FROM world WHERE name = 'Germany'查詢顯示面積為 5,000,000 以上平方公里的國家,該國家的人口密度(population/area)。人口密度並不是 WOR...原创 2020-05-05 09:52:29 · 1031 阅读 · 0 评论 -
MySQL中常用的一些操作表,字段和数据的SQL语句(三)
mysq 整理当中的第三部分六、获取部分行(分页)当数据量过大时,在一页中查看数据是一件非常麻烦的事情语法select * from 表名 limit start,count说明: 从start开始 获取count条数据例: 查询前3行男生的信息select * from students where gender=1 limit 0,3;示例: 分页已知:每页显示m条数...原创 2020-04-08 22:25:55 · 182 阅读 · 0 评论 -
MySQL中常用的一些操作表,字段和数据的SQL语句(二)
一、MYSQL查询创建数据库、数据表-- 创建数据库create database python_test_1 charset=utf8;-- 使用数据库use python_test_1;-- students表create table students( id int unsigned primary key auto_increment not null, ...原创 2020-04-08 15:44:45 · 166 阅读 · 1 评论