Introduction:-
Hii Friends...
Today I explain how to create tables in sql. The first thing is what is sql ? The sql is the Structured Query Language. And in sql we can create many types of tables so i explain all types of tables.
Step:1 Firstly we create a table then we apply all types of queries on this table and give it a name. I give it (customer) name.
Step:2 Now we can apply all queries.
1) Select :-
SELECT * FROM Customers;
Syntax :-
SELECT column_name,column_name
FROM table_name;
FROM table_name;
Examples:-
SELECT CustomerName,City FROM Customers;
Output:- All CustomerName and city will show.
How To Add a column in predefine Table
ALTER TABLE tblSubCategory
ADD Size varchar(50)
OR
Alter table tblShopping_SellerProduct
Add EstimatedDays int not null default 0
Output:- Two extra columns are shows.
How To Make a query for date filtering
select * from tblMLM_EWalletTransaction where CONVERT(Date,Adddate,103) between CONVERT(Date,'" + txtfromdateEwallet.Text + "',103) and CONVERT(Date,'" + txttodateEwallet.Text + "',103)");
How To Make a Subquery
How To Add a column in predefine Table
ALTER TABLE tblSubCategory
ADD Size varchar(50)
OR
Alter table tblShopping_SellerProduct
Add EstimatedDays int not null default 0
Output:- Two extra columns are shows.
How To Make a query for date filtering
select * from tblMLM_EWalletTransaction where CONVERT(Date,Adddate,103) between CONVERT(Date,'" + txtfromdateEwallet.Text + "',103) and CONVERT(Date,'" + txttodateEwallet.Text + "',103)");
How To Make a Subquery
select *,(select Firstname from tblShopping_Customer Where Msrno=s.SenderMsrno) as SenderName,
(select Firstname from tblShopping_Customer Where Msrno=s.ReceiverMsrno) as ReceiverName from tblsms as S
(select Firstname from tblShopping_Customer Where Msrno=s.ReceiverMsrno) as ReceiverName from tblsms as S
0 comments:
Post a Comment