Mastering the INSERT Statement in SQL

CapableAmethyst avatar
CapableAmethyst
·
·
Download

Start Quiz

Study Flashcards

50 Questions

Which clause follows the FROM clause in a SELECT statement?

WHERE clause

What does the IS NULL operator do?

Returns TRUE when the value is NULL

Which data type represents a special value that indicates either unknown or inapplicable data?

NULL

Which arithmetic or comparison operator returns NULL when one or more operands are NULL?

All operators return NULL when one or more operands are NULL

Which database model is based on a tabular data structure?

Relational model

Which sublanguage of SQL defines the structure of the database?

Data Definition Language (DDL)

Which statement is used to create a new database in SQL?

CREATE DATABASE

Which database models were dominant in the 1960s and 1970s?

Hierarchical and network models

Which statement is used to select a default database for use in subsequent SQL statements?

USE DatabaseName

What type of data were relational databases initially designed for?

Transactional data

Which rule governs the number of values per cell in a table?

Exactly one value per cell

What type of data is characterized by unprecedented data volumes and rapidly changing data structures?

Big data

Which data type represents numbers with fractional values?

DECIMAL

Which data type category represents positive and negative integers?

Integer data types

Which statement is used to delete a table and all its rows from a database?

DROP TABLE

Which operator computes a value from one or more other values?

Arithmetic operator

Which statement accurately describes referential integrity in a relational database?

Referential integrity requires foreign key values to be fully NULL or match some primary key value.

Which action rejects an insert, update, or delete that violates referential integrity?

RESTRICT

What does the action SET NULL do when a foreign key is invalid?

Sets the invalid foreign key to NULL

What does the action SET DEFAULT do when a foreign key is invalid?

Sets the invalid foreign key to the foreign key default value

What does the action CASCADE do in relation to primary key changes?

Propagates primary key changes to foreign keys

What clauses specify the actions for primary key updates and deletes in MySQL?

ON UPDATE and ON DELETE

Which statement is true about the INSERT statement?

Columns may be omitted from an INSERT statement

Which statement is true about the UPDATE statement?

All rows are updated if the WHERE clause is omitted

Which statement is true about the DELETE statement?

All rows in the table are deleted if the WHERE clause is omitted

Which statement is true about the TRUNCATE statement?

TRUNCATE is similar to a DELETE statement, but with minor differences

Which of the following is a correct statement about sets and tuples?

Sets are unordered collections of elements, while tuples are ordered collections of elements.

Which of the following is a correct statement about tables and columns?

A table has a fixed tuple of columns, while a column has a varying set of rows.

Which of the following is a correct statement about data types?

A data type is a named set of values, from which column values are drawn.

Which of the following is a correct statement about relational operations?

Union selects rows common to two tables.

Which statement is true about named constraints in SQL?

Named constraints appear in error messages when violated.

What is the correct syntax for adding a named CHECK constraint to a table in SQL?

ADD CONSTRAINT ConstraintName CHECK (expression)

Which clause is used to drop a named UNIQUE constraint in SQL?

DROP INDEX ConstraintName

What happens when a table contains data that violates a newly added constraint in SQL?

Adding the constraint fails.

Which clause is used to drop a named constraint in SQL?

DROP CONSTRAINT ConstraintName

Which statement is true about dropping a table in SQL?

Dropping a table fails when it has a foreign key constraint referring to another table's primary key.

What is the correct syntax for adding a named PRIMARY KEY constraint to a table in SQL?

ADD CONSTRAINT ConstraintName PRIMARY KEY (Column1, Column2.)

Which statement is true about unnamed constraints in SQL?

Unnamed constraints appear in error messages when violated.

Which clause is used to drop a named FOREIGN KEY constraint in SQL?

DROP FOREIGN KEY ConstraintName

What is the correct syntax for adding a named FOREIGN KEY constraint to a table in SQL?

ADD CONSTRAINT ConstraintName FOREIGN KEY (Column1, Column2.) REFERENCES TableName (Column)

Which constraint governs values in a single column?

NOT NULL

Which constraint appears in a separate clause of a CREATE TABLE statement and governs values in one or more columns?

FOREIGN KEY

Where can the UNIQUE constraint be applied?

Both in the column declaration and a separate clause

What does the UNIQUE constraint ensure?

Values in a table are unique

Is the UNIQUE constraint necessary for primary key columns?

No, it is unnecessary

What does MySQL create for each UNIQUE constraint?

An index

What does MySQL do when new values are inserted or updated with a UNIQUE constraint?

It checks for duplicates in the column

Can a PRIMARY KEY constraint on a single column appear in the column declaration?

Yes, it can appear in the column declaration

Can a PRIMARY KEY constraint on a composite column appear in the column declaration?

No, it must appear in a separate CREATE TABLE clause

Does a PRIMARY KEY constraint on a composite column require a separate CREATE TABLE clause?

Yes, it requires a separate CREATE TABLE clause

Test your knowledge on the INSERT statement in SQL with this quiz. Learn about the INSERT INTO and VALUES clauses, inserting multiple rows, and assigning DEFAULT and NULL values.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Mastering Jurisdiction Objections in Administrative Courts
19 questions
Mastering the Insert Tab
3 questions
Mastering Critical Care for Older Patients
30 questions
Use Quizgecko on...
Browser
Browser