sql-join Flashcards
1
Q
What is a foreign key?
A
column whose value references a row from another table
2
Q
How do you join two SQL tables?
A
SELECT *
FROM “products”
JOIN “suppliers” USING (“supplierId”);
3
Q
How do you temporarily rename columns or tables in a SQL statement?
A
SELECT "p"."name" AS "product", "p"."category", "s"."name" AS "supplier", "s"."state" FROM "products" AS "p" JOIN "suppliers" AS "s" USING ("supplierId");