Manipulation Flashcards

1
Q

What does SQL stand for?

A

Structured Query Language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are relational databases?

A

A database that organizes info into one or more tables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s a table?

A

A collection of data values organized into rows and columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s a column?

A

A set of data values of a particular type (id, name, age).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s a row?

A

A single record in a table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s a statement?

A

Text that the database recognizes as a valid command. Statements always end in a semicolon ;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s a clause?

A

Performs a specific task in SQL. Written in capital letters. Also referred to as a command. (SELECT, CREATE TABLE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s a parameter?

A

A list of columns, data types, or values that are passed to a clause as an argument.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CREATE

A
CREATE TABLE celebs (
    id INTEGER,
    name TEXT,
    age INTEGER 
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

INSERT

A

INSERT INTO celebs (id, name, age)

VALUES (1, ‘Justin Bieber’, 22);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

SELECT

A

SELECT name FROM celebs;

will return all data in the name column from the table

SELECT * FROM celebs;

will return every column in the table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ALTER

A

ALTER TABLE celebs

ADD COLUMN twitter_handle TEXT;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

UPDATE

A

UPDATE celebs
SET twitter_handle = ‘@taylorswift13’
WHERE id = 4;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

DELETE

A

DELETE FROM celebs
WHERE name IS ‘Taylor Swift’;

will remove Taylor Swift from the table.

WHERE twitter_handle IS NULL;

IS NULL is a condition in SQL that returns true when the value is NULL and false otherwise.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are constraints?

A

Constraints that add info about how a column can be used are invoked after specifying the data type for a column.

CREATE TABLE awards (
    id INTEGER PRIMARY KEY,
    recipient TEXT NOT NULL,
    award_name TEXT DEFAULT 'Grammy'
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Section Review

A

SQL is a programming language designed to manipulate and manage data stored in relational databases.

Relational database is a database that organizes info into one or more tables.

Table is a collection of data organized into rows and columns.

Statement is a string of characters that the database recognizes as a valid command (CREATE TABLE, INSERT INTO, SELECT, ALTER TABLE, UPDATE, DELETE FROM).

Constraints add info about how a column can be used.