T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 64
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 215
  Visitor Online : 3
  Today Visit: 296
  Total Visitor : 301318
  Most Online : 41
::: Sponsored Links :::

PR 4 For This Webpage

Vinaora Logo
Home Today :

Introduction to SQL - The SQL Language


SQL is a tool for organizing, managing, and retrieving data stored by a computer database. The acronym SQL is an abbreviation for Structured Query Language. For historical reasons, SQL is usually pronounced "sequel," but the alternate pronunciation "S.Q.L." is also used. As the name implies, SQL is a computer language that you use to interact with a database. In fact, SQL works with one specific type of database, called a relational database.

What is Table ?

A relational database system contains one or more objects called tables. The data or information for the database are stored in these tables. Tables are uniquely identified by their names and are comprised of columns and rows. Columns contain the column name, data type, and any other attributes for the column. Rows contain the records or data for the columns. Here is a sample table called "student".



SQL Queries :

+ Selecting Data:
The SQL SELECT statement queries data from tables in the database. The statement begins with the SELECT keyword. The basic SELECT statement has 3 clauses:
+ SELECT
+ FROM
+ WHERE
The SELECT clause specifies the table columns that are retrieved. The FROM clause specifies the tables accessed. The WHERE clause specifies which table rows are used. The WHERE clause is optional; if missing, all table rows are used.
Example SELECT statement :
Select LName From Customer



Example SELECT with WHERE :

Select LName From Customer where ciy='Roma'



Conditional selections used in the where clause:

= Equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
<> Not equal to
LIKE *See note below


The LIKE pattern matching operator can also be used in the conditional selection of the where clause. Like is a very powerful operator that allows you to select only rows that are "like" what you specify. The percent sign "%" can be used as a wild card to match any possible character that might appear before or after the characters specified.

Example :

select first, last, city
from empinfo
where first LIKE 'Gin%';


This SQL statement will match any first names that start with 'Gin'. Strings must be in single quotes.

Or you can specify,

select first, last
from empinfo
where last LIKE '%s';

This statement will match any last names that end in a 's'.

select * from empinfo
where first = 'Ginger';

This will only select rows where the first name equals 'Ginger' exactly.

Example : you have table with information :



Run command :
select first, last, city
from empinfo
where first LIKE 'Gin%';


Result :



Continue.......

Author : T4VN Team

Other Tutorials

::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007