Wednesday, 30 November 2011

SQL Create DB

The CREATE DATABASE statement is used to Create a Database. SQL CREATE DATABASE Syntax CREATE DATABASE  DataBasename CREATE DATABASE Example We use the following CREATE DATABASE statement: CREATE DATABASE Inventory Database tables can be added with the CREATE TABLE statement. ...

SQL Order By

The ORDER BY KeywordThe ORDER BY keyword is used to sort the result-set by a specified column. The ORDER BY keyword sort the records in ascending order by default. If you want to sort the records in a descending order, you can use the DESC keyword. The "custmast" table: custcode custname city qty rate 1 Siva Srivilliputtur 50 70 2 Bala Sivakasi 30 56 3 Kanna Madurai 100 200 4...

SQL AND & OR

 The AND operator displays a record if both the first condition and the second condition is true.  The OR operator displays a record if either the first condition or the second condition is true. The syntax for a compound condition is as follows: SELECT "column_name" FROM "table_name" WHERE "simple condition" {[AND|OR] "simple condition"}+ The "custmast" Table: custcode custname city qty rate 1 Siva...

SQL Where

The WHERE clause is used to extract only those records that fulfill a specified criterion. SQL WHERE Syntax SELECT column_name(s) FROM table_name WHERE column_name operator value Table Name : CustMast custcode custname city qty rate 1 Siva Srivilliputtur 50 70 2 Bala Sivakasi 30 56 3 Kanna Madurai 100 200 4 Vijay Chennai ...

SQL Distinct

The SELECT keyword allows us to grab all information from a column (or columns) on a table. This, of course, necessarily mean that there will be redundancies. What if we only want to select each DISTINCT element? This is easy to accomplish in SQL. All we need to do is to add DISTINCTafter SELECT. The syntax is as follows: SELECT DISTINCT "column_name" FROM "table_name" For example,  ...

Followers

Powered by Blogger.