SQL - Manipulation Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

relational database

A

A relational database is a database that organizes information into one or more tables.

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

table

A

A table is a collection of data organized into rows and columns.

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

_______ creates a new table.

A

CREATE TABLE

CREATE TABLE celebs (
id INTEGER,
name TEXT,
age INTEGER
);

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

_______ adds a new row to a table.

A

INSERT INTO

INSERT INTO celebs (id, name, age)
VALUES (1, ‘Justin Bieber’, 29);

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

_______ queries data from a table.

A

SELECT

SELECT name FROM celebs;

SELECT * FROM celebs;

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

_______ changes an existing table

A

ALTER TABLE

ALTER TABLE celebs
ADD COLUMN twitter_handle TEXT;

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

_______ edits a row in a table

A

UPDATE

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

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

_______ deletes rows from a table

A

DELETE FROM

DELETE FROM celebs
WHERE twitter_handle IS NULL;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
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
10
Q

What is a relational database?

A

A database that organizes information into one or more tables.

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

Which clause is used with the ALTER TABLE statement?
- INTO
- ADD COLUMN
- JOIN
- SELECT

A

ADD COLUMN

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

UPDATE ________
SET height = 6
WHERE id = 1;

  • column name
  • the keyword INTO
  • row name
  • table name
A

Table name

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

What is a NULL value?

A

A value that represents missing or unknown data

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

What are the four common data types in SQL?

A

Integer, Text, Date, Real

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

Which of the following statements is correct and complete?

DELETE FROM icecream
WHERE flavor IS NULL;

WHERE flavor IS NULL;

WHERE flavor IS NULL
DELETE FROM icecream;

DELETE icecream
WHERE flavor NULL;

A

DELETE FROM icecream
WHERE flavor IS NULL;

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

What is the purpose of the * character?

SELECT *
FROM celebs;

A

It selects every column in the table.

17
Q

What does the INSERT statement do?

A

Insert new rows into a table.

18
Q

What would be correct syntax for a CREATE TABLE statement?

CREATE meals
name TEXT
rating INTEGER

CREATE TABLE meals (
name TEXT,
rating INTEGER
);

NEW TABLE meals (
name TEXT,
rating INTEGER
);

CREATE meals (
name TEXT,
rating INTEGER
);

A

CREATE TABLE meals (
name TEXT,
rating INTEGER
);