Table of Contents
A database usually comprises at least one table. The tables are identified with the name (e.g., “ID” or “Class”). Tables have records (rows) that contain information.
Below is an example of a database table named “details”:
The table above contains five records (one for each name) and four columns (Id, name, class, section).
Most of the tasks you have to do in a database are accomplished using SQL statements.
Following SQL statement is a search for all records of the “details” table:
SELECT * FROM details
Note: SQL keywords are NOT case sensitive: select is the same as SELECT
So, the above code is correct in lowercase as well.
select * from details
SQL Statements – Semicolon?
Some databases require a semicolon to be added at the end of every SQL statement.
The semicolon is the preferred method to distinguish every SQL statement in databases which allows multiple SQL statements to execute on the same request on the server.
Important SQL Commands
- SELECT – Use to extract data from a database
- UPDATE – Use to update data in a database
- DELETE – Use to delete data from a database
- INSERT INTO – Use to insert new data into a database
- CREATE DATABASE – Use to create a new database
- ALTER DATABASE – Use to modify a database
- CREATE TABLE – Use to create a new table
- ALTER TABLE – Use to modify a table
- DROP TABLE – Use to delete a table
- CREATE INDEX – Use to create an index (search key)
- DROP INDEX – Use to delete an index
If you find anything incorrect in the above-discussed topic and have further questions, please comment below.