Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

SQL Syntax

This document provides an overview of SQL statements and commands. It discusses selecting data from tables, updating, deleting, and inserting data. It also covers creating databases and tables as well as modifying and dropping them. Standard SQL syntax and keywords are presented.

Uploaded by

Harsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

SQL Syntax

This document provides an overview of SQL statements and commands. It discusses selecting data from tables, updating, deleting, and inserting data. It also covers creating databases and tables as well as modifying and dropping them. Standard SQL syntax and keywords are presented.

Uploaded by

Harsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

 Tutorials  Exercises  Services   Sign Up Log in

HTML
 CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C

SQL Syntax
❮ Previous Next ❯

SQL Statements
Most of the actions you need to perform on a database are done with SQL statements.

SQL statements consists of keywords that are easy to understand.

The following SQL statement returns all records from a table named "Customers":

Example Get your own SQL Server

Select all records from the Customers table:

SELECT * FROM Customers;

Try it Yourself »

In this tutorial we will teach you all about the different SQL statements.

Database Tables
A database most often contains one or more tables. Each table is identified by a name (e.g.
"Customers" or "Orders"), and contain records (rows) with data.
In this tutorial we will use the well-known Northwind sample database (included in MS Access and
 Tutorials 
MS SQL Server). Exercises  Services   Sign Up Log in

HTML
Below isCSS JAVASCRIPT
a selection SQL table
from the Customers PYTHON
used in theJAVA PHP
examples: HOW TO W3.CSS C

CustomerID CustomerName ContactName Address City PostalCode Country

1 Alfreds Maria Anders Obere Str. 57 Berlin 12209 Germany


Futterkiste

2 Ana Trujillo Ana Trujillo Avda. de la México 05021 Mexico


Emparedados y Constitución D.F.
helados 2222

3 Antonio Antonio Mataderos México 05023 Mexico


Moreno Moreno 2312 D.F.
Taquería

4 Around the Thomas 120 Hanover London WA1 1DP UK


Horn Hardy Sq.

5 Berglunds Christina Berguvsvägen Luleå S-958 22 Sweden


snabbköp Berglund 8

The table above contains five records (one for each customer) and seven columns (CustomerID,
CustomerName, ContactName, Address, City, PostalCode, and Country).

ADVERTISEMENT

Keep in Mind That...


SQL keywords are NOT case sensitive: select is the same as SELECT

In this tutorial we will write all SQL keywords in upper-case.

Semicolon after SQL Statements?


Some database systems require a semicolon at the end of each SQL statement.
Semicolon is the standard way to separate each SQL statement in database systems that allow more
 than one Tutorials 
SQL statement Exercises 
to be executed Services 
 call to the server.
in the same Sign Up Log in

HTML CSS weJAVASCRIPT


In this tutorial, SQL
will use semicolon at the PYTHON JAVA
end of each SQL PHP
statement. HOW TO W3.CSS C

Some of The Most Important SQL Commands


SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index

❮ Previous Log in to track progress Next ❯

ADVERTISEMENT

You might also like