SQL Cheat Sheet
SQL Cheat Sheet
SQL Cheat Sheet
2. Select the code that shows the population density of China, Australia, Nigeria and France
3. Show the name and population in millions for the countries of the continent 'South America'.
4. Show the countries which have a name that includes the word 'United'
SELECT name
FROM world
WHERE name LIKE 'United %'
5. Exclusive OR (XOR). Show the countries that are big by area or big by population but not both. Show
name, population and area. A country is big if it has an area of more than 3 million sq km or it has a
population of more than 250 million.
SELECT name,population,area
FROM world
WHERE population >= 250000000
OR
area >= 3000000
6. Ako je već definirana tablica i treba dodati primarni ključ na stupac ID_ucenik, koji od ponuđenih upita je
ispravan
10. Poredaj riječi tako da upit ispravno unose redak u tablicu Ucenici: 'Domagoj','Duvnjak'); INTO ,VALUES,
Ucenici, INSERT, (
11. Postavi upit koji briše učenika iz tablice Ucenici kome je prezime Karabatić
12. Ispravi sljedeći upit: CREATE Gradovi (id_grad int, naziv nchar, zupanija)
SELECT
UPDATE
INSERT INTO
17. With SQL, how do you select a column named"FirstName" from a table named "Persons"?
18. With SQL, how do you select all the records from atable named "Persons" where the value of the
column"FirstName" is "Peter"?
19. With SQL, how do you select all the records from a table named "Persons" where the value of the column
"FirstName" starts with an "a"?
20. With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and
the "LastName" is "Jackson"?
21. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
22. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
23. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?