Section 1

Preview this deck

How do you define a foreign key?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (11)

Section 1

(11 cards)

How do you define a foreign key?

Front

FOREIGN KEY (columns) REFERENCES Other_Table(columns)

Back

Some aggregate functions:

Front

sum min max avg bool_and bool_or

Back

How do you add records?

Front

INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);

Back

How do you create a primary key?

Front

PRIMARY KEY (columns)

Back

How do you make a table?

Front

CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... );

Back

What is a full outer join?

Front

A full outer join includes every tuple in both table, even if there is not a matching tuple in the other table. If there is not a matching tuple in the other table, its attributes are filled with NULL.

Back

How do you update records?

Front

UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;

Back

How do you delete records?

Front

DELETE FROM table_name WHERE condition;

Back

What is the order of the clauses of an SQL query?

Front

SELECT [ ALL | DISTINCT ]... FROM from_item [, ...] ] [ WHERE condition ] [ GROUP BY grouping_element [, ...] ] [ HAVING condition [, ...] ] [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ] [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ] [ LIMIT { count | ALL } ] [ OFFSET start [ ROW | ROWS ] ]

Back

How do you delete a table?

Front

DROP TABLE table_name;

Back

What is a left outer join?

Front

A left outer join contains all tuples in the left table, even if there is not a matching tuple in the right table. If there is not a matching tuple in the right table, its attributes are filled with NULL.

Back