Monday 30 May 2016

Tuesday 24 May 2016

SQL Code


create table lkl(
name varchar(10));
select * from abc1;
select name from abc1;
create table employe2(
Emp_no int not null,
Name varchar(15),
Father_name varchar(15));

select name, Father_name from employe2;
insert into employe(Emp_no, Name, Father_name)
values(112,'ALI','Ahmad'),
select * from employe2;

where Emp_no=112;

Delete from employe
where name='ali';


update employe
SET name='Ayan'
WHERE name='Ali';


create  table employee1(
empname varchar(20),
SSNNO varchar(10),
City varchar(10),
salary int);


insert into employee1
values('Ahmad', '124', 'ISB', 40000);

select *
from employee;
select empname, salary, City
from employee
where empname='Ahmad'and
city='ISB';
Alter table employee
Add desig varchar(10);

create table student1(
roll_no int,
name varchar(15),
pregramme varchar(15),
semester varchar(5),
primary key (roll_no));
insert into student1
values(113, 'Saba', 'BSCS','3rd');

create table cources1
(course_code varchar(10),
couse_name varchar(15),
roll_no int,
primary key (course_code),
foreign key(roll_no) references student(roll_no ));

drop table Ads;

select * from employee989;
truncate table Branches;

select * from employee989;
where city in('Isd','Fsd');

delete from employee989
where Emp_no=107;
drop table orders;
create table orders(
order_Id int not null,
order_date varchar(20),
order_description varchar (100),
primary key(Order_Id));
insert into orders
values(111,'25-04-16', 'abc'),(112,'25-04-16', 'abc'),(113,'25-04-16', 'abc'),
(116,'25-04-16', 'abc'),(115,'25-04-16', 'abc');
select * from orders;
drop table Customer;
create table customer(
Customer_ID int, customer_name varchar(20),
Order_Id int, Customer_Adress varchar(100),
primary key(Customer_ID),
foreign key(order_Id)references orders(order_Id));
select * from customer;
insert into customer
values(511,'Asad',111,'ISB');
select orders.order_Id, orders.order_description,customer.customer_ID,
customer.Order_Id
from orders , customer
where orders.order_Id=customer.Order_Id;

select order_Id, order_description
from orders;

Friday 20 May 2016