sql-join Flashcards
1
Q
What is a foreign key?
A
A FOREIGN KEY is a key used to link two tables together.
A FOREIGN KEY is a field (or collection of fields) in one table that refers to the PRIMARY KEY in another table.
2
Q
How do you join two SQL tables?
A
join clause “table name” using (“commoncolumn”)
3
Q
How do you temporarily rename columns or tables in a SQL statement?
A
we can alias their names as follows: select "p"."name" as "product", "p"."category", "s"."name" as "supplier", "s"."state" from "products" as "p" join "suppliers" as "s" using ("supplierId");