SQL Insert Update Delete

                   Create,Insert,Update and Delete Statement

Creating a Table:

Syntax for craeting a table:
Create table tabel_name (column1_name data type,column2_name data type,column3_name data type)
You can add columns as many you want.

Create table namely account and specify two columns.

create table account(Account_Name varchar(20),Balance bigint)

Inserting Records:

Now to insert values into table

insert into account (Account_Name,Balance) values('john','40000')

insert into account (Account_Name,Balance) values('Nash','30000')

You can also insert values like this but in this case your have to take care about sequence of columns as defind in creation of table

insert into account values('john','40000')

insert into account values('Nash','30000')

insert into account values('Peter','45000')

insert into account values('Ian','25000')


Updating records

Syntax for update:

Update table_name set column_name=’Newvalue’ where Account_name=’Somevalue’


update account set balance='30000' where Account_name='Ian'

You can update multiple columns at a time as

update table_name set column1='SomeValue',column2='SomeValue'


Deleting a record:

delete from account where Account_name='Ian'

you can delete all records from a table

delete from tableName

This will delete all records from table

Comments

Popular posts from this blog

Using Progress Bar In C#

Get elements by class name in javascript

Jquery serer side datatables in asp.net