--Querying SQL server 2005


select * from customers;


select companyName,ContactName from customers
where contactName='Christina Berglund';

select count(reportsto) from employees

--you can count all except the Null
select count(*) from employees

--you can count allthe record include null

insert into customers (customerId,CompanyName,ContactName)values('Ms','Microsoft','BillGates')

select firstname,lastname from employees where firstName='nancy'

/*

select firstname,lastname,birthDate ,sum(employeeId)"SumTotal"

from employees

WHERE LASTnAME LIKE '%O%'


group by firstName,lastName,birthDate
having firstName like '%a%'


order by FirstName desc ;

*/

/*
select * from products where productId >50


--joining
select [order Details].orderId,products.productId,Quantity From [Order Details]
inner join products on [order details].productId=products.productId


--left outer join
select * from table1 as t1 left outer join table2 as t2 on t1.id=t2.id

--cross join

select * from table2 as t2 cross join table1 as t1

select * from table1
select* from table2


--union
select id ,name from table1 union select id,job from table2

---if the select id true then print exist
select 'exits'
where exists(select* from table1 where id=5)

-- Data Manipulation Language
use Ibm
--Insert into Table1 values(7,'ado')
--update table1 set name='' Where id=10;
--Delete from table1 where id=6

----Data Definition language

create database h9
Go
create table t1 (nom nvarchar(40))
Go
use h9
insert into t1 (nom) values ('Linux')
Go
Select * from t1;

--getDate()

*/

Hosted by www.Geocities.ws

1