Tables and Data Manipulation
1.
What is a table?
A table stores related data. Tables store data in the form of rows and columns, where each row stores the details about an entity and columns store values of a specific characteristic of the entities.
2.
What are the characteristics of a table are?
3.
What are CONTRAINTS?
Constraints are the restrictions composed on the columns of a table. When data is entered in any column of a table, it is validated against the constraints applied to that column. Data is accepted only if it does not violate any constraint.
4.
What are TRIGGERS?
Triggers consist of an event, a condition and an action. A condition must be satisfied during an event for an action to take place. An action included the related procedure after an event occurs. When an event occurs, the condition is checked and the appropriate action performed.
5.
What are ASSERTIONS?
An assertion is a condition that a database must satisfy. Each time the database is modified, it checks for the validity of the assertions defined in the database. If any transaction violates the assertions, the transaction is rejected.
6.
How to apply a NOT NULL constraint to a table?
The NOT NULL constraint can be applied either when you design the table or after you create the table.
7.
How to add data to a table, Project, if the Project table
has the following fields:
· iProjectID
· vProjectName
· vProjectDescription
· dSTartDate
To add data to a table use the INSERT statement.
INSERT INTO project
VALUES
(22, ‘Project 1’, ‘New Project’, ‘07/29/2004’)
8.
What are System defined data types?
Each system defined data type stores a specific type of data exclusively. For example, you cannot store characters in a column that is defined as integer.
What are User defined data types?
these data types are used when several tables must store the same type of customized data in their columns. For example, a data type can be created with the name, address, data type varchar, length 100, and Nullability false. This data type can then be assigned to the columns that store addresses.
9.
What is the process of modifying tables?
You may want to add a column, change a data type, or add constraints to an existing table. The alter command enables you to modify a table after it is created. You can use the ALTER COLUMN command to rename a column or change the data type of the column. You can also use it to change the size of the column.
10.
What is Foreign Key?
This contains a reference clause that refers to a column or a group of columns in the same or another table. A foreign key constraint can be applied to a column or a group of columns.
What is NOT NULL?
This is a column constraint that restricts the column from accepting null values. This constraint can be applied to one or more columns of a table.
What is CHECK?
It is also a column constraint that allows a user to enter a value within a range that can be specified in the form of a condition.
What is DEFAULT?
This is a column constraint that specifies a default value for a field whenever a new record is inserted. Users can change the value.
11.
What is the difference between Type constraints and Attribute constraints?
· Type constraints are used to set a valid of range for the user-defined data types.
· Attribute constraints are implemented by applying the data type for each column when the column is created. This ensures that every data item in a column is of the same type.
12.
What is the role of DML commands?
DML (Data Manipulation Language) enable you to perform insert, update, and delete operations.