SQL Tutorial For Advanced Level
What is SQL?
Ø SQL stands for Structured Query Language
Ø SQL lets you access and manipulate databases
Ø SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987
What Can SQL do?
ü SQL can execute queries against a database
ü SQL can retrieve data from a database
ü SQL can Insert records in a database
ü SQL can update records in a database
ü SQL can delete records from a database
ü SQL can create new databases
ü SQL can create new tables in a database
ü SQL can create stored procedures in a database
ü SQL can create views in a database
ü SQL can set permissions on tables, procedures, and views
Note:
· However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
Using SQL in Your Web Site
v An RDBMS database program (i.e. MS Access, Sql Server, MySQL)
v To use a server-side scripting language, like PHP or ASP
v To use SQL to get the data you want
v To use HTML / CSS to style the page
RDBMS
· RDBMS stands for Relational Database Management System.
· RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
· The data in RDBMS is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows.
Look at the "Customers" table:
How use where condition:
Where:
The where clause use operators can be used
Example:
Table name:demo
Syntax=select *from demo where country=’india’;
Operators | Description |
= | Equal |
Note: not equal operator may current version this method use != | |
> | Greater than |
Less than | |
>= | Greater than equal to |
Less than equal to | |
BETWEEN | Between inclusive range |
LIKE | Search for pattern |
IN | To specify the Multiple value for a column |
SQL AND,OR and NOT
SQL Use AND Condition:
Sql and condition check condition condition true is display the record and condition false no display the record
For example:
Select * from demo where name=’test’ and fathersname=’test1’;
OR :
OR condition use any one condition true display database record
NOT:
AND ,OR condition any condition true not condition totally different way this working condition opposite working the not condition
Syn: select * from demo where not country=’india’
ORDER BY ID:
The order by id data value set ascending or descending order.
Syn: select * from colum1,colum2 from demo order by tablename asc|desc;
Ascending order to Descending Order Particular Column Name In Mysql
Syn:
SELECT * FROM tablename
ORDER BY Colum name ASC, BY Colum name DESC;
SQL insert table:
The insert statement used insert new record and store the person details
Syn: insert into tablename(colum1,colum2……column) values(value1,value2,…valuen);
This post first appeared on WebDesign | SEO Services Full Tutorial | PHP Full Tutorial | Javascript Full Tutorial|HTML,CSS,CMS, please read the originial post: here