A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS). Together, the data and the DBMS, along with the applications that are associated with them, are referred to as a database system, often shortened to just database. Each Database often contains one or more tables. Each Table may have different columns e.g. Customer Name, Contact Number, Address. Tables contain records(rows) with data.
SQL follows some unique set of rules and guidelines called syntax. Here, we are providing all the basic SQL syntax.
- SQL is not case sensitive. Generally SQL keywords are written in uppercase.
- SQL statements are dependent on text lines. We can place a single SQL statement on one or multiple text lines.
- You can perform most of the action in a database with SQL statements.
- SQL depends on relational algebra and tuple relational calculus.
SQL statements are started with any of the SQL commands/keywords like SELECT, INSERT, UPDATE, DELETE, ALTER, DROP etc. and the statement ends with a semicolon (;).
SELECT "column_name" FROM "table_name";
Semicolon is used for separating two SQL Statements.
It is a standard way to separate SQL statements in a database system in which more than one SQL statements are used in the same call.
These are the some important SQL command:
- SELECT: it extracts data from a database.
- UPDATE: it updates data in database.
- DELETE: it deletes data from database.
- CREATE TABLE: it creates a new table.
- ALTER TABLE: it is used to modify the table.
- DROP TABLE: it deletes 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.
- CREATE INDEX: it is used to create an index (search key).
- DROP INDEX: it deletes an index.