SQL Script Terms

  1. (SQL Scripting): What is meant by CLUSTERED?
    This index type defines the order in which data is physically stored in a table. Table data can be sorted in only way, therefore, there can be only one clustered index per table. In SQL Server, the primary key constraint automatically creates a this type of index on that particular column.
  2. (SQL Scripting): What is meant by NON-CLUSTERED?
    This type of index doesn’t sort the physical data inside the table. In fact, this index is stored at one place and table data is stored in another place. This is similar to a textbook where the book content is located in one place and the index is located in another. This allows for more than one of these types of indexes per table.
  3. (SQL Scripting): What is a PRIMARY KEY Constraint?
    This constraint uniquely identifies each record in a table.
  4. (SQL Scripting):What is a FOREIGN KEY constraint?
    This is a key used to link two tables together.

    Additionally:

    This key is a field (or collection of fields) in one table that refers to the PRIMARY KEY in another table.

    The table containing the this key is called the child table, and the table containing the candidate key is called the referenced or parent table.
  5. (SQL Scripting):What is a CHECK constraint?
    This constraint is used to limit the value range that can be placed in a column.

    • Example:
    • Image Upload 2
  6. (SQL Scripting):What is a DEFAULT constraint?
    This  constraint is used to provide a default value for a column.

    • Example:
    • Image Upload 4
  7. (SQL Scripting):What is a CREATE INDEX statement?
    This statement is used to create indexes in tables.

    • Example:
    • On single column:
    • Image Upload 6

    • On multiple columns:
    • Image Upload 8
  8. (SQL Scripting):What is an INDEX used for?
    These are used to retrieve data from the database more quickly than  otherwise. The user cannot see them, they are used to speed up searches or queries.
  9. (SQL Scripting):What is a CREATE UNIQUE INDEX statement?
    Creates a unique index on a table. Duplicate values are not allowed.

    • Example of syntax:
    • Image Upload 10
  10. (SQL Scripting): What is a VIEW?
    This is a virtual table based on the result-set of an SQL statement.

    • Example:
    • Image Upload 12

    • User queries VIEW like a normal table or tables:
    • Image Upload 14
Author
geschw66
ID
350559
Card Set
SQL Script Terms
Description
Terms or keywords used when scripting a database (INSERT, UPDATE, CLUSTERED, UNIQUE etc...)
Updated