융무의 기술블로그
article thumbnail
[SQL][sqlzoo] Self join
Algorithm/SQL 2020. 7. 2. 21:07

Self join Self join - SQLZOO Edinburgh Buses Details of the database Looking at the data stops(id, name) route(num, company, pos, stop) stops id name route num company pos stop How many stops are in the database. SELECT COUNT(*) FROM stops Find the id value for the stop 'Craiglockhart sqlzoo.net 1. How many stops are in the database. SELECT COUNT(id) FROM stops 2. Find the id value for the stop ..

article thumbnail
[SQL][sqlzoo] Using Null
Algorithm/SQL 2020. 7. 2. 21:01

Using Null Using Null - SQLZOO teacher id dept name phone mobile 101 1 Shrivell 2753 07986 555 1234 102 1 Throd 2754 07122 555 1920 103 1 Splint 2293 104 Spiregrain 3287 105 2 Cutflower 3212 07996 555 6574 106 Deadyawn 3345 ... dept id name 1 Computing 2 Design 3 Engineering ... Teacher sqlzoo.net 1.NULL, INNER JOIN, LEFT JOIN, RIGHT JOIN SELECT name FROM teacher WHERE dept IS NULL 2. Note the I..

article thumbnail
[SQL][sqlzoo] More JOIN operations
Algorithm/SQL 2020. 7. 2. 20:56

More JOIN operations More JOIN operations - SQLZOO This tutorial introduces the notion of a join. The database consists of three tables movie , actor and casting . movie id title yr director budget gross casting movieid actorid ord More details about the database. 1962 movies List the films where the yr is sqlzoo.net 1.1962 movies SELECT id, title FROM movie WHERE yr=1962 2.When was Citizen Kane..

article thumbnail
[SQL][sqlzoo] The JOIN operation
Algorithm/SQL 2020. 7. 2. 20:44

JOIN The JOIN operation - SQLZOO game id mdate stadium team1 team2 1001 8 June 2012 National Stadium, Warsaw POL GRE 1002 8 June 2012 Stadion Miejski (Wroclaw) RUS CZE 1003 12 June 2012 Stadion Miejski (Wroclaw) GRE CZE 1004 12 June 2012 National Stadium, Warsaw POL RUS ... goal matchid t sqlzoo.net 1. SELECT matchid, player FROM goal WHERE teamid = 'GER' 2. SELECT id,stadium,team1,team2 FROM ga..

article thumbnail
[SQL][sqlzoo] SUM and COUNT
Algorithm/SQL 2020. 7. 2. 20:37

SUM and COUNT SUM and COUNT - SQLZOO World Country Profile: Aggregate functions This tutorial is about aggregate functions such as COUNT, SUM and AVG. An aggregate function takes many values and delivers just one value. For example the function SUM would aggregate the values 2, 4 and 5 to del sqlzoo.net 1.Total world population SELECT SUM(population) FROM world 2.List of continents select distin..

article thumbnail
[SQL][sqlzoo] SELECT within SELECT
Algorithm/SQL 2020. 7. 2. 20:32

SELECT within SELECT SELECT within SELECT Tutorial - SQLZOO This tutorial looks at how we can use SELECT statements within SELECT statements to perform more complex queries. namecontinentarea populationgdp AfghanistanAsia6522302550010020343000000 AlbaniaEurope28748 2831741 12960000000 AlgeriaAfrica2381741 37100000 sqlzoo.net 1.Bigger than Russia SELECT name FROM world WHERE population > (SELECT ..

article thumbnail
[SQL][sqlzoo] SELECT from Nobel
Algorithm/SQL 2020. 7. 2. 20:29

SELECT from Nobel SELECT from Nobel Tutorial - SQLZOO nobel yr subject winner 1960 Chemistry Willard F. Libby 1960 Literature Saint-John Perse 1960 Medicine Sir Frank Macfarlane Burnet 1960 Medicine Peter Madawar ... nobel Nobel Laureates We continue practicing simple SQL queries on a single table. This tutor sqlzoo.net 1.Winners from 1950 SELECT yr, subject, winner FROM nobel WHERE yr = 1950 2...

article thumbnail
[SQL][sqlzoo] SELECT from world
Algorithm/SQL 2020. 7. 2. 20:28

SELECT from WORLD Tutorial SELECT from WORLD Tutorial - SQLZOO namecontinentarea populationgdp AfghanistanAsia6522302550010020343000000 AlbaniaEurope28748 2831741 12960000000 AlgeriaAfrica2381741 37100000 188681000000 AndorraEurope46878115 3712000000 AngolaAfrica1246700 20609294 100990000000 ... In this tutorial you w sqlzoo.net 1.Introduction SELECT name, continent, population FROM world 2.Larg..