Home | Add to Favorites | Ebooks Directory | News  
SQL & PL/SQL  Resources
Home
SQL , PL/SQL  Article
SQL Tutorial 
Books
SQL  Questions
SQL Code
PL/SQL Tutorial
SQL Reference
SQL Tutorial

ALIAS Functionality with SQL

Syntax:

SELECT <table_alias.column_name1> <column_alias> FROM <table_name > <table_alias>


 

Example 16:

SELECT E.SUM(Age) SUM_ OF_AGES FROM Employee E

RESULT:

--------------------------
| SUM_OF_AGES |
--------------------------
| 157 |
--------------------------

CREATE Tables using the CREATE statement

Creating New Tables

All tables within a database must be created .

Syntax:

Creating New Tables

All tables within a database must be created at some point in time...let's see how we would create the Orders table:

CREATE TABLE <table_name>(<field_name1> <data_type> <characteristic>,......);


 

Example 17:

CREATE TABLE Employee (EmpId INTEGER NOT NULL,Name CHAR(40) NOT NULL);

DESCRIBING the structure of a table

Syntax:

DESCRIBE <table_name>;

Example 18:

DESC Employee;
 

RESULT:

+-------------+---------------------+------+-----+---------+
| Field | Type | Null | Key | Default |
+-------------+---------------------+------+-----+---------+
|EmpId | bigint(20) | | PRI | NULL |
| Name | varchar(100) | | | 0 |
|Age | varchar(200) | | | 0 |
+---------------+--------------------+------+------+----------+
3 rows in set (0.00 sec)
 

                                                       Go To Index