CS401A's Pre-Finals: Info Management Module 07 Flashcards
For pre-final and final exams. (32 cards)
SQL Data Manipulation Commands
- The basic data manipulation commands are:
INSERT, SELECT, UPDATE, and DELETE.
SQL Data Manipulation Commands
— \_\_\_\_ \_\_\_ \_\_\_\_\_\_\_\_\_\_\_\_
to a table
○ Syntax: INSERT INTO table name (columns) VALUES (values);
-
INSERT INTO
adds new rows/records
SQL Data Manipulation Commands
— adds new rows/records to a table
○ Example: \_\_\_\_\_\_ \_\_\_\_
Students (LastName, Section) \_\_\_\_\_\_
(‘Reyes’, ‘IT102’);
-
INSERT INTO
INSERT INTO
VALUES
SQL Data Manipulation Commands
○ To \_\_\_ \_\_\_ \_\_\_\_\_\_\_
to \_\_\_
columns of a table
■ Syntax: INSERT INTO table_name VALUES (values);
-
INSERT INTO
add new records
all
SQL Data Manipulation Commands
○ To add new records to all columns of a table
■ Example: \_\_\_\_\_\_ \_\_\_\_
Students \_\_\_\_\_\_
(‘Reyes’, ‘IT102’);
-
INSERT INTO
INSERT INTO
VALUES
SQL Data Manipulation Commands
— \_\_\_\_\_\_\_\_\_ \_\_\_\_\_\_
of \_\_\_ \_\_\_\_
or a \_\_\_\_\_\_ \_\_ \_\_\_\_
in a table
○ Syntax: SELECT columns FROM table_name;
-
SELECT
retrieves values
all rows
subset of rows
SQL Data Manipulation Commands
— retrieves values of all rows or a subset of rows in a table
○ Example: \_\_\_\_\_\_
LastName, Section \_\_\_\_
Students;
-
SELECT
SELECT
FROM
SQL Data Manipulation Commands
○ To \_\_\_\_\_\_ \_\_\_
columns:
■ Syntax: SELECT * FROM table_name;
-
SELECT
________select all________
SQL Data Manipulation Commands
○ To select all columns:
■ Example: ` ______ _ ____` Students;
-
SELECT
SELECT * FROM
SQL Data Manipulation Commands
— an operator used with \_\_\_\_\_\_
to \_\_\_\_\_\_\_\_ \_\_\_\_\_\_ \_\_\_\_\_\_
from \_\_\_\_\_\_\_
in a table
○ Syntax: SELECT DISTINCT columns FROM table_name;
-
DISTINCT
SELECT
retrieve unique values
columns
SQL Data Manipulation Commands
— an operator used with SELECT to retrieve unique values from columns in a table
○ Example: \_\_\_\_\_\_ \_\_\_\_\_\_\_\_
Section \_\_\_\_
Students;
-
DISTINCT
SELECT DISTINCT
FROM
SQL Data Manipulation Commands
— an option used with \_\_\_\_\_\_
to \_\_\_\_\_\_
the ` ____ __ ____ based on
________ ________`
○ Syntax: SELECT columns FROM table_name WHERE condition;
-
WHERE
SELECT
filter
rows of data
provided criteria
SQL Data Manipulation Commands
— an option used with SELECT to filter the rows of data based on provided criteria
○ Example: \_\_\_\_\_\_ _ \_\_\_\_
Students \_\_\_\_\_
Section = ‘IT101’;
-
WHERE
SELECT * FROM
WHERE
SQL Data Manipulation Commands
— an option used with SELECT to filter the rows of data based on provided criteria
○ To select numeric fields, do not \_\_\_\_\_\_\_
in ` _________ _____`.
Example: SELECT * FROM Students WHERE Age >= 18;
-
WHERE
enclose
quotation marks
SQL Data Manipulation Commands
— an operator used with \_\_\_\_\_\_
to \_\_\_\_\_\_\_\_\_
whether a field is \_\_\_\_\_ \_\_ \_\_\_
○ Syntax: SELECT columns FROM table_name WHERE column IS NULL;
-
IS NULL
SELECT
determine
empty or not
SQL Data Manipulation Commands
— an operator used with SELECT to determine whether a field is empty or not
○ Example: \_\_\_\_\_\_
LastName, Section \_\_\_\_
Students \_\_\_\_\_
Section \_\_ \_\_\_\_
;
-
IS NULL
SELECT
FROM
WHERE
IS NULL
SQL Data Manipulation Commands
— an operator used with \_\_\_\_\_
to \_\_\_\_\_\_\_\_\_
whether a value \_\_\_\_\_\_\_
a \_\_\_\_\_ \_\_\_\_\_\_ \_\_\_\_\_\_\_
○ Syntax: SELECT columns FROM table_name WHERE column LIKE pattern;
-
LIKE
WHERE
determine
matches
given string pattern
SQL Data Manipulation Commands
— an operator used with WHERE to determine whether a value matches a given string pattern
○ Wildcards: % represents \_\_\_\_
, \_\_\_
, or \_\_\_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_\_
while _ represents a \_\_\_\_\_\_ \_\_\_\_\_\_\_\_\_
-
LIKE
zero
one
multiple characters
single character
SQL Data Manipulation Commands
— an operator used with WHERE to determine whether a value matches a given string pattern
○ Example: \_\_\_\_\_\_ _ \_\_\_\_
Students \_\_\_\_\_
LastName \_\_\_\_
‘_b%’;
-
LIKE
SELECT * FROM
WHERE
LIKE
SQL Data Manipulation Commands
○ Example: SELECT * FROM Students WHERE LastName LIKE ‘_b%’;
○ Meaning: All students with last names have ‘_
’ in the \_\_\_\_\_\_
position.
-
LIKE
________b________
second
SQL Data Manipulation Commands
— an operator used with \_\_\_\_\_
to \_\_\_\_\_
whether a value \_\_\_\_\_\_\_ \_\_\_ \_\_\_\_\_
within a \_\_\_\_\_ \_\_\_\_
○ Syntax: SELECT columns FROM table_name WHERE column IN (values);
-
IN
WHERE
check
matches any value
given list
SQL Data Manipulation Commands
— an operator used with WHERE to check whether a value matches any value within a given list
○ Example: \_\_\_\_\_\_ _ \_\_\_\_
Students \_\_\_\_\_
Section \_\_
(‘IT101’, ‘IT102’, ‘IT103’);
-
IN
SELECT * FROM
WHERE
IN
— an operator used with \_\_\_\_\_
to \_\_\_\_\_
whether a value is \_\_\_\_\_\_
a \_\_\_\_\_
○ Syntax: SELECT column FROM table_name WHERE column BETWEEN value1 AND value2;
-
BETWEEN
WHERE
check
within
range
SQL Data Manipulation Commands
— an operator used with WHERE to check whether a value is within a range
○ Example: \_\_\_\_\_\_ _ \_\_\_\_
Students \_\_\_\_\_
Age \_\_\_\_\_\_\_
13 \_\_\_
15;
-
BETWEEN
SELECT * FROM
WHERE
BETWEEN
AND