Shared Flashcard Set

Details

Multiple Tables - SQL
codecademy Multiple Tables Cheat Sheet
11
Software
12th Grade
04/10/2023

Additional Software Flashcards

 


 

Cards

Term
Outer Join(LEFTJOIN) does what function?
Definition
An outer join will combine rows from different tables even if the join condition is not met.
Term
Outer Join(LEFTJOIN) Syntax:
Definition
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
Term
What is the function of the WITH clause?
Definition
The WITH clause stores the result of a query in a temporary table (temporary_movies) using an alias.

Multiple temporary tables can be defined with one instance of the WITH keyword.
Term
WITH clause syntax:
Definition
WITH temporary_movies AS (
SELECT *
FROM movies
)
SELECT *
FROM temporary_movies
WHERE year BETWEEN 2000 AND 2020;
Term
UNION clause does what function?
Definition
The UNION clause is used to combine results that appear from multiple SELECT statements and filter duplicates.
Term
UNION clause syntax:
Definition
SELECT name
FROM first_names
UNION
SELECT name
FROM last_names
Term
CROSS JOIN does what function?
Definition
The CROSS JOIN clause is used to combine each row from one table with each row from another in the result set. This JOIN is helpful for creating all possible combinations for the records (rows) in two tables.
Term
CROSS JOIN syntax:
Definition
SELECT shirts.shirt_color,
pants.pants_color
FROM shirts
CROSS JOIN pants;
Term
What is a Foreign Key?
Definition
A foreign key is a reference in one table’s records to the primary key of another table.
Term
What is a Primary Key?
Definition
A primary key column in a SQL table is used to uniquely identify each record in that table. A primary key cannot be NULL.
Term
What is an Inner JOIN used for?
Definition
The JOIN clause allows for the return of results from more than one table by joining them together with other results based on common column values specified using an ON clause.

It will only return results matching the condition specified by ON.
Supporting users have an ad free experience!