Zybooks Questions Flashcards
When to use DISTINCT keyword?
To remove duplicate values from query results
When to use UNIQUE keyword?
Constraint on column to make sure they only contain unique values
What is Data Definition Language (DDL)?
Defines database structure ie CREATE TABLE
What is Data Query Language (DQL)?
Retrieves data ie SELECT
What is Data Manipulation Language (DML)?
Inserts, updates, deletes in database
_____ may appear in each cell.
Exactly one value
What is the correct statement format to drop a table?
DROP Table tableName;
What is the statement to do the following – Delete the column ShortDesc. from Deparment table?
ALTER TABLE Department DROP ShortDesc;
What are WITH CHECK OPTIONS?
Database rejects inserts and updates that do not satisfy the view query
What is CHECK when used with a constraint?
A way to check if values meet a condition
How do you add or change constraint on an existing column?
Use CHANGE —- CHANGE table column datatype constraint. This is for unnamed constraints
How do you add a named constraint to an existing column?
Use ADD CONSTRAINT in an ALTER TABLE statement
Can you add a value with NULL?
NO
________ languages contain control flow statements but no classes
Procedural
_____ is the leading declarative language.
SQL
SQL uses many keywords, like SELECT, FROM, and WHERE. C relies heavily on punctuation, like {} and #. This is an example of the ______ gap.
Syntax
The EXEC SQL keyword is used in procedural SQL. T/F
False
Usually generates a network round trip for each SQL query.
Embedded SQL
Affords the greatest database security.
Procedural SQL
Which form of SQL needs a precompiler
Embedded SQL
Most Procedural SQL languages implement the entire SQL/PSM standard T/F
False
First character in a user-defined variable.
@
Consists of a simple or compound statement.
Body
May appear in the body of a stored procedure.
CALL
Precedes a parameter name in a <parameter-declaration>.</parameter-declaration>
INOUT
Optional in CREATE PROCEDURE statements.
<parameter-declaration>
</parameter-declaration>
Stored functions may be executed from the MySQL command line. T/F
True
The <parameter-declaration> has the same syntax in stored procedures and stored functions T/F</parameter-declaration>
False
All embedded SQL statements require an active connection. T/F
True
Shared variables can appear in which clause of an embedded SELECT statement?
Both INTO and WHERE clauses
In the declaration section, shared variables are assigned a data type in:
The host language
The ________ statement associates a cursor name with a query.
DECLARE
The _____ statement assigns query results to shared variables.
FETCH
The ________ statement positions a cursor before the first row of a result table.
OPEN
A(n) _______ statement must appear before an EXECUTE statement without the IMMEDIATE keyword.
PREPARE
Shared variables appear in an EXECUTE statement with the ______ clause
USING
Statements that are written explicitly in program code are ______ SQL.
static
The precompiler cannot compile ______ SQL statements.
dynamic
The executeQuery() method:
Both compiles and executes an SQL statement.
In the Informix set type, the base type must be a group of character strings T/F
False