SQL - Manipulation Flashcards
relational database
A relational database is a database that organizes information into one or more tables.
table
A table is a collection of data organized into rows and columns.
_______ creates a new table.
CREATE TABLE
CREATE TABLE celebs (
id INTEGER,
name TEXT,
age INTEGER
);
_______ adds a new row to a table.
INSERT INTO
INSERT INTO celebs (id, name, age)
VALUES (1, ‘Justin Bieber’, 29);
_______ queries data from a table.
SELECT
SELECT name FROM celebs;
SELECT * FROM celebs;
_______ changes an existing table
ALTER TABLE
ALTER TABLE celebs
ADD COLUMN twitter_handle TEXT;
_______ edits a row in a table
UPDATE
UPDATE celebs
SET twitter_handle = ‘@taylorswift13’
WHERE id = 4;
_______ deletes rows from a table
DELETE FROM
DELETE FROM celebs
WHERE twitter_handle IS NULL;
What does SQL stand for?
Structured Query Language
What is a relational database?
A database that organizes information into one or more tables.
Which clause is used with the ALTER TABLE statement?
- INTO
- ADD COLUMN
- JOIN
- SELECT
ADD COLUMN
UPDATE ________
SET height = 6
WHERE id = 1;
- column name
- the keyword INTO
- row name
- table name
Table name
What is a NULL value?
A value that represents missing or unknown data
What are the four common data types in SQL?
Integer, Text, Date, Real
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;
DELETE FROM icecream
WHERE flavor IS NULL;