CREATE TABLE table_name ( Column_name1 datatype([size]), Column_name2 datatype([size]), )
Example: CREATE TABLE tbl_customer ( customer_id int, fname varchar(50), lname varchar(50), phone varchar(16), address varchar(100), city varchar(50) )
SQL INSERT SYNTAX:
INSERT INTO table_name ([column names separated with commas]) VALUES (data values)
Example: Insert into tbl_customer(customer_id, fname, lname, phone, address, city) Values (‘172-32-1176’, ’White’, ‘Johnson’, ‘408 496-7223’, ’10932 Bigge Rd.’, ‘Menlo Park’)
SQL UPDATE SYNTAX:
UPDATE table_name SET column_name = {value to assign} WHERE {Search condition}
Example: UPDATE tbl_customer SET city = ‘Park Plaza’ WHERE customer_id = ‘172-32-1176’
SQL DELETE SYNTAX:
DELETE FROM table_name WHERE {search condition}
Example: To delete all rows from the table: DELETE FROM tbl_customer
To delete specific rows: DELETE FROM tbl_customer WHERE customer_id = ‘172-32-1176’
Following are the Base Data types for SQL Server 2000 and above that can be used to specify the column data type appropriate for the data that is to be inserted into the particular column are:
binary
bigint
bit
char
datetime
decimal
float
image
int
money
nchar
ntext
nvarchar
numeric
real
smalldatetime
smallint
smallmoney
sql_variant
sysname
text
timestamp
tinyint
varbinary
varchar
uniqueidentifier
To learn SQL SELECT statement click here...
Be the first to rate this post
Tags: sql, sql free tutorial, sql commands, sql insert command, sql update command, sql delete command
10/11/2008 3:41:34 AM