Friday, December 21, 2018

THESE BASIC ELEMENTS OR DATA OBJECTS INCLUDE TABLES SCHEMAS VIEWS AND MORE

These basic elements or data objects include tables schemas views and more

SQL Command Types

Before you start programming in SQL, you need to understand its basic command categories in performing various functions – database creation, object manipulation, data population and update, data deletion, query submission, access control and database administration, among others. The following are the main categories:

  • Data Definition Language (DDL)

Data Definition Language (or simply DDL) enables you to create, change or restructure, and even destroy the basic elements that are contained in a relational database. DDL focuses only on the structure, not the data contained within the elements. These basic elements or data objects include tables, schemas, views and more. Having no independent physical existence, a view is regarded as a virtual table in which its definition only exists in the metadata. However, the view’s data comes from the table (or tables) where you will derive the view. Stated below are some of the most common DDL commands:

  • CREATE – This command statement is responsible for building the database structure. Its syntax is:

CREATE TABLE

CREATE VIEW

  • ALTER – This command statement is in charge of changing the database structure after it has been created. Its syntax is:

ALTER TABLE

ALTER VIEW

  • DROP – This command is the reverse of the CREATE statement, which destroys the database structure. Its syntax is: