Skip to main content

Featured

Constraints

NOT NULL CONSTRAINT -    Ensures that a column cannot have a null value. DEFAULT CONSTRAINT -    Provides a default value for a column when none is specified  UNIQUE CONSTRAINT -   Ensures that all values in columns are different  CHECK CONSTRAINT -   Makes sure that all values in a column satisfy certain criteria  PRIMARY KEY CONSTRAINT -   Used to uniquely identify a row in the table  FOREIGN KEY CONSTRAINT -   Used to ensure referential integrity of the data  Primary Key - is used uniquely to identify each row in a table . It can consist of one or more columns on a table . When Multiple columns are used on a table it is called composite key.  Foreign Key - Foreign key is a column or columns that references a column most often primary key of another table . The purpose of foreign key is to maintain referential integrity of the data. Pg admin  Data base - training - right click on training - query click  Always add semi colen to run the query  Int - integer  varchar - variable charact

DBMS And SQL Commands

Data Base Management System - It is used to define , manage and process data bases . 

It allows modification of data , You need to retrieve that through queries , allows storage for long period , enables in recovery in times of failure and control access to users . 

Types of SQL Commands :

It is divided into 5 Parts -

1. Data Definition Language (DDL) - It enables you to define the structure of data . Used for creating and managing elements such as tables and schemas . We added change or deleted table .(Data base designers and architects)

Common DDL Commands - 

a. Create Command - It will create a particular table and the data base .

b. Alter Command - It helps to alter the columns with any table 

c. Drop Command - It is used to delete a particular table from the data base.

2. Data Manipulation Language (DML) - It helps to manipulate the data stored . You will be able to add , change or delete the data from a particular data . We are adding , changing the data within the table.(Operations and DB managers)

a. Inset command - which helps insert into the table 

b. Update - It will change the values in already inserted table 

c. Delete - To delete particular rows of the table 

3. Data Query Language (DQL) - Used for retrieving the stored data . Main focus of business users . It starts with select clause then mentions the table name from where the data to be fetched . (Analysts)

4. Data Control Language (DCL) - It is used to control the access privileges to users to access data within the data base. Common statements are GRANT , REVOKE . Grant which will grant privileges to a particular user. Revoke which will revoke a particular privilege from a user . (Database Admin)

5. Transactional Control Commands (TCC) - It gives the power to manipulate various transactions over the data base , it can  be used to maintain data integrity . Commit and Rollback . Commit will make changes done  to database permanent , Rollback which rollbacks data points to a particular point .(Operations and DB managers) 


Comments

Popular Posts