Advertisement
Warmachine28

Untitled

Feb 8th, 2022
772
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create database USICT;
  2. use USICT;
  3. create table student (
  4.     stu_id int,
  5.     stu_name varchar(255)
  6. );
  7. desc student;
  8. create table faculty (
  9.     fac_name varchar(255),
  10.     fac_id int
  11. );
  12.  
  13. create table stream (
  14.     CSE varchar(255),
  15.     IT varchar(255),
  16.     ECE varchar(255)
  17. );
  18.  
  19.  
  20. alter table student add column (
  21.     DOB varchar(255)
  22. );
  23.  
  24.  
  25. alter table student modify column DOB date;
  26. delete from student where city='Mumbai';
  27. alter table student drop column state;
  28. select * from student where stu_name='Dhiraj' or stu_id=0841641216;
  29. alter table stream add column (
  30.     EEE varchar(255)
  31. );
  32. select * from faculty where fac_salary >= 55000;
  33. select * from faculty order by fac_salary asc;
  34. select * from faculty where fac_name like 'r%';
  35. select * from faculty where fac_city in (select fac_city from faculty where fac_name='Manoj');
  36.  
  37. alter table faculty add column (fac_subjects varchar(255));
  38. select * from faculty where fac_subjects <> 'DBMS' and  fac_subjects <> 'AI';
  39. select faculty.fac_name,faculty.fac_salary,faculty.fac_city from faculty
  40. inner join stream on stream.CSE=faculty.fac_name
  41. where faculty.fac_subjects='DBMS';
  42.  
  43.  
  44.  
  45. create table employee(
  46.     Sno int primary key not null auto_increment,
  47.     emp_id bigint,
  48.     emp_name varchar(255),
  49.     emp_dept varchar(255),
  50.     emp_salary int,
  51.     emp_city varchar(255)
  52. );
  53. select * from employee where emp_city = 'Noida' or emp_city = 'New Delhi';
  54. update employee set emp_salary = emp_salary + emp_salary*0.2 where emp_city = 'Greater Noida';
  55. select * from employee where emp_name = 'Akash' or emp_id = 12116491214;
  56. select * from employee where emp_salary in (select max(emp_salary) from employee where emp_dept = 'ECE') and emp_dept = 'ECE';
  57. select * from employee where emp_city <> 'New Delhi' and emp_city <> 'Gurgaon';
  58.  
  59.  
  60.  
  61.  
  62.  
  63. create table aviation_details(
  64.     passenger_name varchar(255),
  65.     flight_no int,
  66.     departure_airport varchar(255),
  67.     arrival_airport varchar(255),
  68.     flight_date date,
  69.     reservation_status varchar(255),
  70.     flight_fare int,
  71.     airlines varchar(255)
  72. );
  73. insert into aviation_details values('Harsh Aggarwal',23335,'New Delhi','Bengaluru','2022-01-31','full',5260,'Vistara'),
  74. ('Dhruv Sachdeva',27690,'New Delhi','Mumbai','2022-02-01','vacant',4560,'IndiGo'),
  75. ('Ujjwal Gautam',52609,'Patna','Kanpur','2022-02-19','full',4789,'Spice Jet'),
  76. ('Arjun Rathore',62555,'New Delhi','Hyderabad','2022-03-02','full',5487,'Air India');
  77.  
  78.  
  79. select passenger_name as Passenger_Name, flight_no as Flight_Number from aviation_details;
  80. select flight_no as 'Flight Number', departure_airport as 'Departure Airport',
  81. arrival_airport as 'Arrival Airport', airlines as 'Airline Vendor'
  82. from aviation_details;
  83. select flight_no as 'Flight Number', airlines as 'Airline Vendor', reservation_status as 'Reservation Status' from aviation_details where flight_no=52609;
  84.  
  85.  
  86. create table train_details(
  87.     train_no int,
  88.     train_src varchar(255),
  89.     train_dest varchar(255),
  90.     train_arr_time time,
  91.     train_dep_time time,
  92.     train_seat_total_seats int,
  93.     train_seats_booked int,
  94.     train_seats_vacant int
  95. );
  96.  
  97. insert into train_details values(22547,'Kanya Kumari','Jammu','19:20:00','19:30:00',380,80,300);
  98.  
  99. select * from train_details where train_src='Delhi' and train_dest='Varanasi';
  100. select * from train_details where train_src='Kanya Kumari' and train_dest='Jammu';
  101. select train_no,train_src from train_details where train_dest='Delhi';
  102. select * from train_details where train_dest<>'Gaziabad';
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. insert into stream values('Manoj','Rachita Rana','Reena Gupta','Anuj Sharma');
  111. insert into employee(emp_id,emp_name,emp_dept,emp_salary,emp_city)values(12116491221,'Meenal Dahiya','IT',120000,'Greater Noida');
  112. update faculty set fac_subjects='Data Structures' where fac_name='Manoj';
  113. insert into student values (0841641220,'Dhiraj','1999-07-13','Varanasi');
  114. insert into faculty values ('Manoj',1009,165000,'Mumbai');
  115. alter table faculty rename column city to fac_city;
  116. alter table employee modify column emp_id bigint;
  117. delete from student where DOB='0000-00-00';
  118. delete from train_details where train_no='12628';
  119. drop table aviation_details;
  120. drop table train_no;
  121. desc student;
  122. desc stream;
  123. desc faculty;
  124. desc stream;
  125. select * from student;
  126. select * from faculty;
  127. select * from employee;
  128. select * from aviation_details;
  129. select * from train_details;
  130. select * from stream;
  131. desc employee;
  132. desc aviation_details;
  133.  
  134.  
  135.  
  136.  
  137.  
Advertisement
RAW Paste Data Copied
Advertisement