SELECT basics

From SQLZOO
(Redirected from SQLZOO:SELECT basics)
Jump to: navigation, search
Language: English  • Deutsch • 中文
namecontinentarea populationgdp
AfghanistanAsia6522302550010020343000000
AlbaniaEurope28748 2831741 12960000000
AlgeriaAfrica2381741 37100000 188681000000
AndorraEurope46878115 3712000000
AngolaAfrica1246700 20609294 100990000000
....

Introducing the world table of countries

This tutorial introduces SQL. We will be using the SELECT command on the table world:

Summary

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 Germany

SELECT population FROM world
  WHERE name = 'France'
SELECT population FROM world
  WHERE name = 'Germany'

Norton Support Phone Number 18889880636 for Norton Customer Service Phone Number Norton Support Phone Number -18889880636 for Norton Customer Service Phone Number,Norton antivirus Tech Support Toll Free Number Norton antivirus support phone number Norton antivirus help phone number Norton number Norton internet security customer service phone number Norton antivirus 1888 number Norton Toll Free Number Norton 360 login Phone Number Norton 360 login to account my Norton 360 account login Norton 360 my account Norton activation Norton product activation how do i activate my Norton product Norton 360 activation install Norton 360 how to activate my Norton antivirus product key Norton antivirus customer service phone number 18889880636 NORTON antivirus phone number support Norton support contact number Norton contact number for billing Norton customer service phone number activate Norton 360 with product key how do i activate my Norton product register Norton product i have Norton product key Norton 360 activation install Norton 360 Norton account activation Norton 360 my account Norton 360 telephone number Norton number Symantec Norton security contact phone number Norton number Norton online help Norton 360 contact number contact Norton customer support Norton customer care number Norton customer care Norton Symantec telephone number Norton internet security telephone number Norton internet security customer service number Symantec customer service number 1-18889880636 Symantec customer service phone number Norton 360 telephone number Norton internet security telephone number Norton technical support phone number Norton technical support phone number us Norton 360 contact number Norton antivirus customer service number phone number for Norton customer service Norton contact phone number Norton antivirus telephone number phone number for Norton antivirus Norton security contact number 18889880636

Scandinavia

Checking a list The word IN allows us to check if an item is in a list. The example shows the name and population for the countries 'Luxembourg', 'Mauritius' and 'Samoa'.

Show the name and the population for 'Ireland', 'Iceland' and 'Denmark'.


SELECT name, population FROM world
  WHERE name IN ('Luxembourg', 'Mauritius', 'Samoa');
SELECT name, population FROM world
  WHERE name IN ('Ireland', 'Iceland', 'Denmark');

You are ready for tutorial one:SELECT statements with WHERE.


Language: English  • Deutsch • 中文

Just the right size

Which countries are not too small and not too big? BETWEEN allows range checking (range specified is inclusive of boundary values). The example below shows countries with an area of 250,000-300,000 sq. km. Modify it to show the country and the area for countries with an area between 200,000 and 250,000.

SELECT name, area FROM world
  WHERE area BETWEEN 250000 AND 300000


SELECT name, area FROM world
  WHERE area BETWEEN 200000 AND 250000


You are ready for tutorial one:SELECT statements with WHERE.


Language: English  • Deutsch • 中文