Week 4 Flashcards
(41 cards)
What are four basic SQL operations?
Create, Read, Update, and Delete (CRUD)
What does DDL stand for?
Data definition language - used to define, change, or drop database objects
What does DML stand for?
Data manipulation language - used to read and modify data
What does DCL stand for?
Data control language - used to grant and revoke authorizations
How can you create a table in SQL?
create table myTable (myColumn1 integer)
What are some 7 basic data types in SQL?
integer, float, decimal, char, date, time, blob
What does a UNIQUE constraint do?
A UNIQUE constraint prevents duplicate values in a table. This is implemented using unique indexes and is specified in the CREATE TABLE statement using the keyword UNIQUE. A NULL is part of the UNIQUE data values domain.
What does a PRIMARY KEY constraint do?
A PRIMARY KEY constraint is similar to a UNIQUE constraint, however, it excludes NULL as valid data. Primary keys always have an index associated with them. This defines a primary key for the table.
What does a REFERENTIAL constraint do?
A REFERENTIAL constraint is used to support referential integrity which allows you to manage relationships between tables.
What does a A CHECK constraint do?
A CHECK constraint ensures the values you enter into a column are within the rules specified in the constraint.
Can Referential integrity be defined during and after a table is created?
Referential integrity can be defined during table definition or after the table has been
created.
What is the name of a table whose column values depend on the values of other tables?
A table whose column values depend on the values of other tables is called a dependent, or
child table
What is a base or parent table?
A table being referenced by a child table or dependent.
When the constraint name is not specified what will happen in DB2?
The DB2 system will generate the name automatically
What are some delete action types?
A delete action type can be a CASCADE, SET NULL, NO ACTION, or RESTRICT.
What are some update action types?
An update action type can be a NO ACTION or RESTRICT.
What is a schema?
A schema in DB2 is a database object that allows you to group related database objects together
How do you create a schema?
create schema mySchema
What is a view?
A view is a virtual table derived from one or more tables or other views. It is virtual because
it does not contain any data, but a definition of a table based on the result of a SELECT
statement
Can views be used for security?
Views allow you to hide data or limit access to a select number of columns; therefore, they
can also be used for security purposes.
What does * represent?
All columns from a table
what does SELECT do in SQL?
Selecting data in SQL is an operation that allows you to read (retrieve) rows and columns
from a relational table.
What is a cursor in SQL?
A cursor is a resulting set from your selection
What are the three things cursors can do in SQL?
Open (set/file/result), Fetch line by line, and Close (set/file/result)