SQL Flashcards
Nom d’une commande en SQL
clause. s’écrit en majuscule ex: CREATE TABLE
SQL creates a new table. adds a new row to a table. queries data from a table. edits a row in a table. changes an existing table. deletes rows from a table.
CREATE TABLE INSERT INTO SELECT UPDATE ALTER TABLE DELETE FROM
How to use clause WHERE name LIKE ‘exemple’ to search
names like ‘se[1 character]en’
names beginning with letter ‘a’
names containing ‘man’
WHERE name LIKE ‘se_en’
WHERE name LIKE ‘a%’
WHERE name LIKE ‘%man%’
SQL : comment trouver tous les films dont l’année est comprise entre 1990 et 2000
SELECT * FROM movies
WHERE year BETWEEN 1990 AND 2000
SQL : classer les films par ordre décroissant de classement IMDB, afficher le top 3
SELECT * FROM movies
ORDER BY imd_rating DESC
LIMIT 3;
SQL : récupérer le nombre d’apps par groupe de prix
SELECT price, COUNT(*) FROM fake_apps
GROUP BY price;
SQL : apps Calculate the average number of downloads at each price. In the code editor type
rounding the average number of downloads to two decimal
SELECT price, ROUND(AVG(downloads),2) FROM fake_apps
GROUP BY price;
SQL : Comment désigne-t-on les différents types de clés
foreign keys and primary keys
SQL : fonction pour transformer un timestamp en date
select date(timestamp)