What is basic SELECT statement?

Image
SELECT Statement
A SELECT statement retrieves data from the database. With SELECT statement PROJECTION, SELECTION and JOIN can be performed on database tables.
As data in relational database is stored in TABLES. TABLE has ROW and COLUMN structure. With SELECT statement all rows and all columns can be retrieved, this is known as PROJECTION. But, if rows and columns are retrieved on the basis of some condition, it is known as SELECTION. And suppose if some information is needed and that is stored in two or more different tables but are related, use JOINS to retrieve it from two or more tables.
In SQL, basic SELECT statements are as follows:
SELECT * FROM [table_name];
SELECT[column1][column2][column3],..... FROM  [table_name];
SELECT and FROM are known as clauses. 
SELECT clause allows to specify columns to be selected from the database table. 
FROM clause allows to specify table name that has those column to be selected.
Semicolon at the end of SELECT statement specify the end of SQL statemen…

What are different database languages?

Database system allows end user to read, create, update, delete and to perform other functions on stored data. To make this possible database system provide interfaces and languages for interacting with the system. Database languages are categorized as follows:

1) DDL (Data Definition Language)
Database administrators (DBAs) and designers use DDL to create physical and logical schema for database systems. Also, a language called storage definition language (SDL) is used to create the physical schema, where it defines the storage structure and access mechanism.

Database systems like Oracle Database, MS SQL Server, IBM DB2, MySQL etc. are equipped with an ANSI standard language, SQL(Structured Query Language). End user can write executable statements using SQL for creating database structures, accessing and manipulating data. SQL provides DDL implementation. CREATE (create schema), ALTER (alter schema), DROP (delete schema) and RENAME (rename schema) are DDL statements in SQL.

2) DML (Data Manipulation Language) 
DML is used to access and manipulate the data stored in database systems. It allow insertion, retrieval, deletion and modification of data. DMLs are categorized in to two forms, Procedural DML and Non-Procedural DML.

In Procedure DML, programmers specify what data is needed and how to obtain that data.This means user has to write procedures to fetch data from database. Procedures are programming blocks that includes programming elements like iterations, decision making, branching etc. Database systems also provide some predefined procedures, sometimes programmers call these procedures in some high-level programming language to develop database applications. Oracle database provide PL/SQL language to write procedural SQLs. 

In Non-Procedural DML, end user write query to fetch data from database. Query is nothing but an executable statement for retrieving data. DML is nothing but a query language. End user only need to specify what data is needed without worrying about how that data can be obtained. INSERT (add data), SELECT (retrieve data), UPDATE (update data) and DELETE (remove data) are DML statements in SQL

3) DCL (Data Control Language) 
DCL is used to control the user access to database systems.It enables to define different type of users with different privileges or access permissions. DBA create users and approve or disapprove permissions like. In SQL these permissions are known as privileges. GRANT and REVOKE statements are used to give and take privileges to users. INSERT (insert permission), SELECT (read permission), UPDATE (update permission) and DELETE (remove permission). In SQL for defining type of user, ROLES are used. These roles have group of privileges assigned for controlling database access.


Comments

Popular posts from this blog

With the help of block diagram explain the architecture of a DBMS.

What do you mean by data model? What are different types of data models?

What are the different types of database users?