SHARE
TWEET

tajidner_2170

a guest Aug 31st, 2015 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create table employee2170 (emp_id varchar(10) primary key,city varchar(15) not null,salary varchar(10),age varchar(10),email_id varchar(35),check(age>17),designation varchar(10) default (AP));
  2.  
  3. insert into employee2170 (emp_id,city,salary,age,email_id)values(11412170,'goraya',100000,19,'tajinder.jhally@gmail.com');
  4. insert into employee2170 (emp_id,city,salary,age,email_id)values(11412171,'jalandhar',10000,21,'taj.jhally@gmail.com');
  5. insert into employee2170 (emp_id,city,salary,age,email_id)values(11412173,'chandighard',200000,19,'jinder.jhally@gmail.com');
  6. insert into employee2170 (emp_id,city,salary,age,email_id)values(11412174,'delhi',500000,19,'lalit.jhally@gmail.com');
  7.  
  8. alter table employee2170 add name varchar(15)
  9.  
  10. select * from employee2170
  11.  
  12. update employee2170  set name ='tajinder' where emp_id = 11412170;
  13. update employee2170  set name ='taj' where emp_id = 11412171;
  14. update employee2170  set name ='jinder' where emp_id = 11412173;
  15. update employee2170  set name ='lalit' where emp_id = 11412174;
  16. update employee2170  set name ='revo' where emp_id = 11412172;
  17.  
  18. ------------------------------------------------------------------------------------------------------
  19.  
  20. create table customer2170 (c_id varchar(10) primary key,name varchar(10),city varchar(10));
  21.  
  22.  
  23. insert into customer2170 (c_id,name,city)values(11412170,'tajinder','goraya');
  24. insert into customer2170 (c_id,name,city)values(11412171,'taj','jalandhar');
  25. insert into customer2170 (c_id,name,city)values(11412172,'jinder','chaard');
  26. insert into customer2170 (c_id,name,city)values(11412173,'lalit','delhi');
  27.  
  28. -----------------
  29.  
  30. create table order2170 (o_id varchar(10) primary key,o_no varchar(20),c_id varchar(10),foreign key(c_id) references customer2170 (c_id));
  31.  
  32.  
  33. insert into order2170 values(1412170,'a0',11412170);
  34. insert into order2170 values(1412171,'a2',11412171);
  35. insert into order2170 values(1412172,'a3',11412173);
  36. insert into order2170 values(1412173,'a4',11412170);
  37.  
  38.  
  39. =--------------------
  40.  
  41. alter table order2170 drop primary key;
  42.  
  43. alter table order2170 add primary key (o_id);
  44.  
  45. alter table order2170 add constraint c_id primary key(c_id);
  46.  
  47. alter table order2170 drop constraint ... ;
  48.  
  49. ---
  50.  
  51. select age from table_name between 20 and 30;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top