Skip to main content

Introduction to SQL



Introduction :


SQL stands for Structured Query Language.
The Oracle Server supports ANSI standard SQL and contains extensions.


What is SQL ?

SQL is the language used to communicate with any Database.
SQL is the standard language for Relation Database System.


Why we use SQL?

- Allow user to create new databases
- Allow user to create tables in database
- Allow user to create Schema objects
- Allow user to create and manipulate data from database.


What is table?


Table is a basic unit of storage.
Table is a combination of rows and columns.
Here, we can store all the data information as cell format.
We can use create statement to create table in database.


--Basic of SQL :


Select clause:

Select statement is used extract data from the database or retrieves information from the database.
with help of select clause we can restrict a column which you want to returned by your query.


From clause:

A From clause, which specifies the table containing the columns listed in the SELECT clause
It is used to tell the compiler from which table(s) the data needs to be fetched by your query.


--Syntax:

SELECT * FROM table_name;

eg:

SELECT * FROM project_tb;


SQL> SELECT * FROM PROJECT_TB;  --Here we select all the data present in project table.

PROJECT_ID PROJECT_NAME
---------- ------------------------------
      1001 Citi Bank
      1002 HDFC

You can display all columns of data in a table by following the SELECT keyword with an asterisk (*).
project table contains two columns such as project_id and project_name.

How we take the project_name column only in table?

SELECT statement to display specific columns of the table by specifying the column names, separated by commas.

SQL> SELECT project_name FROM project_tb;

PROJECT_NAME
------------------------------
Citi Bank
HDFC







Comments

Post a Comment