![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
MySQL
心际花园
编程的主题是人如何处理信息的。编程就像一个迷宫,有无穷无尽的歧路,在其中的体验是有趣的。不必惆怅编程的无限性,重要的是体验过程,而不仅仅是获得结果。
展开
-
SQL 系列教程:SELECT
目的:如果数据无处理,则直接选择表格里的字段如果数据需要处理,则在已处理好的数据中选取字段和计算字段输入:select 和字段名称,计算字段名称语法:选择列 select 字段1,计算字段1选择所有 select *位置:最上面输出:表格里的字段名和相应数据使用场景:SQL任何场合必须使用。注意事项:SELECT 和 FROM在SQL中是必写选项SELECT的字段可以用AS 或空格 为字段起别名SELECT位置在最上面,但执行在最后例题https://sqlzoo.net原创 2021-07-30 09:35:21 · 146 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第9- 关 Window functions
– 第9- 关 Window functions - SQLZOO-- 练习窗口函数--1. Show the lastName, party and votes for the constituency 'S14000024' in 2017.-- 练习where select lastName, party, votes from ge where constituency = 'S14000024' and yr = 2017order by votes desc -- 2原创 2021-06-30 11:12:33 · 190 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第8+关 Numeric Examples
– 第8+关 Numeric Examples NSS Tutorial - SQLZOO--1.Show the the percentage who STRONGLY AGREE-- 熟悉表格nss select A_STRONGLY_AGREEfrom nsswhere question='Q01'and institution='Edinburgh Napier University'and subject='(8) Computer Science'--2. Show the原创 2021-06-24 17:33:38 · 222 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第8关 Using Null - SQLZOO
第8关 Using Null - SQLZOO-- 练习 null -- is null is not null--1.List the teachers who have NULL for their department.-- 练习nullselect name from teacher where dept is null -- 2. Note the INNER JOIN misses the teachers with no department and the dep原创 2021-06-23 15:31:21 · 143 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第7关 More JOIN operations
第7关 More JOIN operations - SQLZOO练习 join-- 1.List the films where the yr is 1962 [Show id, title]-- 练习where select id,title from moviewhere yr=1962-- 2.Give year of 'Citizen Kane'.-- 练习where select yrfrom movie where title = 'Citizen Kane'原创 2021-06-22 11:22:24 · 175 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第6关 The JOIN operation
– 第6关 The JOIN operation - SQLZOO-- 练习join-- 1.Modify it to show the matchid and player name for all goals scored by Germany. To identify German players, check for: teamid = 'GER'-- 练习 where select matchid,playerfrom goalwhere teamid = 'GER'-- 2原创 2021-06-20 20:04:50 · 158 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第5关 SUM and COUNT
– 第5关 SUM and COUNT - SQLZOO-- 练习聚合函数 比如count, sum,avg,max-- 练习 distinct, order by -- 1. Show the total population of the world.-- 练习sum SELECT SUM(population)FROM world--2. List all the continents - just once each. -- 练习 distinctselect distinc原创 2021-06-18 18:04:44 · 128 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第4关 SELECT within SELECT Tutorial
第 4关 SELECT within SELECT Tutorial - SQLZOO练习select嵌套select,也就是子查询。-- List each country name where the population is larger than that of 'Russia'.-- 练习where子查询, 从子查询里筛选数值。select name from world where population > (select population from world原创 2021-06-17 15:06:39 · 295 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第3关 SELECT from Nobel
– 第3关SELECT from Nobel Tutorial - SQLZOO--Change the query shown so that it displays Nobel prizes for 1950.--练习whereSELECT yr, subject, winnerFROM nobelWHERE yr = 1950-- Show who won the 1962 prize for Literature.-- 练习where and SELECT winnerFRO原创 2021-06-17 15:04:53 · 140 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第2关 SELECT from World
第2关, https://sqlzoo.net/wiki/SELECT_from_WORLD_Tutorial-- Observe the result of running this SQL command to show the name, continent and population of all countries.SELECT name, continent, population FROM world-- Show the name for the countries tha原创 2021-06-17 15:02:41 · 496 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第1关 SELECT name
– 第1关, https://sqlzoo.net/wiki/SELECT_names– 练习 like % _-- Find the country that start with Y-- 练习 %select namefrom world where name like 'Y%'-- Find the countries that end with y-- 练习 %select name from worldwhere name like '%y'-- Find th原创 2021-06-17 14:58:09 · 118 阅读 · 0 评论 -
SQLZOOL练习题答案和解析 第0关 0 SELECT basics
SQLZOOL练习题网址https://sqlzoo.net/wiki/SQL_Tutorial目录–第0关 https://sqlzoo.net/wiki/SELECT_basics,– 练习where = in between-- Modify it to show the population of Germany-- 练习 where = 单个筛选 ,字符串要用单引号''select population from worldwhere name = 'Germany'原创 2021-06-17 14:54:53 · 105 阅读 · 0 评论 -
求分组后平均值中的最大值
按洲划分,求每个洲的平均值,再求平均值的最大值select max(good)from(select avg(gdp) as good from world group by continent) as avg01数据来源:SELECT from WORLD Tutorial - SQLZOO原创 2021-06-09 09:10:58 · 240 阅读 · 0 评论 -
MySQL Workbench 8.0新建SCHEMAS和Table
1. 新建 SCHEMASSCHEMAS相当于一个数据库下的小库。点击选项卡下新建new schemas图标(左起第四个)Name可以填写data。Charset/Collation 选择utf8 , utf8-general-ci,也就是中文编码。点击Apply。2. 新建Table在左边栏出现data的标示,选择下拉下的Tables,右击【Create Table】。table的Name可以命名为companytable里的Charset/Collation 选择utf8 , u原创 2021-04-14 15:49:06 · 4374 阅读 · 0 评论