Learn SQL :What is SQL Database , What is SQL Tables , And How it is Implemented.
Let's start with the basic things of SQL:
What is Database?
- A database is the organised collection of the data or we can say a database is a container that hold tables and other SQL structures related to those tables.
- The main purpose of creating the database is to operate large amount of information by storing, retrieving and managing.
- A database is generally represented by a cylindrical structure.
What are tables?
A table is the structure inside the database that contains data, organized in 'columns' and 'rows'
Roll no. | Name | Mobile no. |
1 | Aashu | 81765 |
2 | Ajeet | 83567 |
3 | Aakriti | 74653 |
Fields : It is a small entity of the table which contain specific information about each records or row of the table.
In above table fields are "Roll no., Name, Mobile no."Records or Row : It is the horizontal entity which contain specific information about each individual entry.
Example:
1 | Aashu | 81765 |
Columns : It is the vertical entity which contain specific information associated with the fields.
Example:
Aashu
Ajeet
Aakriti
SQL Syntax:
1. SQL is not case sensitive means we can use upper and lower
case both. But generally the keywords or commands are written in upper case letter
2. We can write SQL statement on one or multiple lines.
SQL commands:
1. SQL is not case sensitive means we can use upper and lower
case both. But generally the keywords or commands are written in upper case letter
2. We can write SQL statement on one or multiple lines.
SQL commands:
- Some of the SQL commands are:
Command | How they work |
SELECT | It extracts data from a database. |
UPDATE | It updates data in database. |
DELETE | It deletes data from database. |
CREATE TABLE | It is used to create the table. |
DROP TABLE | It deletes a table. |
ALTER TABLE | It is used to modify a table. |
CREATE DATABASE | It creates a new database. |
ALTER DATABASE | It is used to modify a database. |
INSERT INTO | It inserts new data into a database. |
SOL Datatypes:
Some common datatypes are:
DATATYPE | SYNTAX | EXPLANATION |
Integer | INT | It is used to specify an integer. |
Character | CHAR(x) | Here 'x' is the character's number to store. |
Decimal | DEC(x,y) | It specify a decimal value in which 'x' is precision value and 'y' is scale value. |
VARCHAR() | It holds text data both in characters and numbers. | |
Blob | BLOB | It is same as CHAR or VARCHAR except the range of storing the text. It can hold more than 256 character. |
Date | DATETIME | It is used to store future event. |
Date | TIMESTAMP | It is used to capture the current date |
Previous Next
No comments: