SQL
文章平均质量分 80
一个好学生-叶纪杉
尘世间一个迷途小书童。
展开
-
HackerRank SQL
HackerRank SQLBasic SelectRevising the Select Query IProblemQuery all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA.The CITY table is described as follows:AnswerSELECT *FR原创 2020-10-26 19:42:05 · 4012 阅读 · 2 评论 -
数据分析实战-User Behavior From Taobao-天池
首发于个人网站:一个好学生一 分析指标和模型指标分析数据集中包含的流量指标——PV和UV。需要注意的是,PV和UV在一定程度上可以看作是虚荣指标。在《精益数据分析》中提到:除非商业模式直接与PV挂钩(即展示广告),则更应该统计访问的人数对于UV只能显示多少人访问了页面,但却不能显示这些人在页面做了什么?为什么停留?是否离开?模型AARRRAARRR分别是Acquisition, ...原创 2019-10-27 22:23:23 · 4942 阅读 · 4 评论 -
MySQL50题-练习
SQL面试50题看了一些SQL面试的题目,这里做个记录。本文代码为MySql。这个练习题目里面共有四张表:Student 学生表字段名 字段含义 字段类型sid 学生编号 varchar(10)sname 学生姓名 varchar(10)sage 学生年龄 datetimessex 学生性别 varchar(10)Student表数据insert into St...原创 2019-08-23 13:38:02 · 2599 阅读 · 2 评论 -
SQL ZOO练习——SELECT from Nobel Tutorial
1. Change the query shown so that it displays Nobel prizes for 1950.SELECT yr, subject, winnerFROM nobelWHERE yr = 19502. Show who won the 1962 prize for Literature.SELECT winnerFROM nobel...原创 2018-08-27 16:10:09 · 428 阅读 · 0 评论 -
SQL ZOO练习——SELECT from WORLD Tutorial
1. Read the notes about this table. Observe the result of running this SQL command to show the name, continent and population of all countries.SELECT name, continent, population FROM world2. How...原创 2018-08-19 14:03:21 · 1464 阅读 · 0 评论 -
SQL ZOO练习——SELECT basics
1. The example uses a WHERE clause to show the population of 'France'. Note that strings (pieces of text that are data) should be in 'single quotes'; Modify it to show the population of GermanySELE...原创 2018-08-19 09:02:55 · 341 阅读 · 0 评论 -
SQL ZOO练习——Using Null
1. List the teachers who have NULL for their department.SELECT name FROM teacherWHERE dept IS NULL2. Note the INNER JOIN misses the teachers with no department and the departments with no teach...原创 2018-08-07 20:46:48 · 1704 阅读 · 0 评论 -
SQL ZOO练习——Self join
1. How many stops are in the database.SELECT COUNT(*)FROM stops2. Find the id value for the stop 'Craiglockhart'SELECT id FROM stopsWHERE name = 'Craiglockhart'3. Give the id and the name...原创 2018-08-10 20:30:54 · 871 阅读 · 0 评论 -
SQL ZOO练习——More JOIN operations
1. List the films where the yr is 1962 [Show id, title]SELECT id, titleFROM movieWHERE yr=19622. Give year of 'Citizen Kane'.SELECT yr FROM movieWHERE title = 'Citizen Kane'3. List all o...原创 2018-08-06 10:28:51 · 642 阅读 · 0 评论 -
SQL ZOO练习——The JOIN operation
1. Modify it to show the matchid and player name for all goals scored by Germany. To identify German players, check for: teamid = 'GER'.SELECT matchid, player FROM goal WHERE teamid = 'GER'2. S...原创 2018-07-31 22:19:06 · 1399 阅读 · 2 评论 -
SQL ZOO练习——The nobel table can be used to practice more SUM and COUNT functions
1. Show the total number of prizes awarded.SELECT COUNT(winner) FROM nobel2. List each subject - just once.SELECT DISTINCT subject FROM nobel3. Show the total number of prizes awarded for Ph...原创 2018-07-30 21:53:49 · 882 阅读 · 0 评论 -
SQL ZOO练习——SUM and COUNT
1. Show the total population of the world.SELECT SUM(population) FROM world2. List all the continents - just once each.SELECT DISTINCT continent FROM world3. Give the total GDP of Africa...原创 2018-07-30 21:01:04 · 600 阅读 · 0 评论 -
SQL ZOO练习——SELECT within SELECT
最近在练习SQL上学习,把结果发上来存个档。1. List each country name where the population is larger than that of 'Russia'.SELECT name FROM world WHERE population > (SELECT population FROM world WHE...原创 2018-07-29 09:49:26 · 1745 阅读 · 0 评论