0% found this document useful (0 votes)
20 views3 pages

SQL MCT Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

SQL MCT Questions

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.what is the difference b/w data and information?

2.what is a database?
3.why do we need a database?
4.advantages of database over file system?
5.what is dbms?
6.what is rdbms?
7.sql
8.is sql a programming language?
9.types of sql command?
10.how to create a database?
11.how to import a csv file inside a database?
12.how to go inside a database?
13.how to know how many tables are present in the database?
14.how to know the structure/description of the table?
15.how to delete a particular database?
16.what does the select command do?
17.explain different types of data types in mysql?
18.how to create a table?
19.how to insert a particular record in the table?
20.how to update a particular record in the table?
21.how to delete a particular record in the table?
22.how to delete all records in one go inside a table?
23.difference b/w drop,delete,truncate command?
24.how to add a column inside a table?
25.how to rename a table?
26.how to delete a column in mysql?
27.how to modify the datatype of a column inside the table?
28.how to rename a column in a table?
29.what are the constraints in mysql?-primary key,foreign key,not null,default,check,unique,
30.explain all constraints?
31.how to add a primary key inside a table?
32.how to drop a primary key
33.how to add a constraint
34.char vs varchar(done)
35.how to drop a constraint
36.explain auto increment.
37.how to modify a big data type column into a small data type column.
38.how to add a foreign key inside a table?
39.on update cascade vs on delete cascade?
40.create a table using primary key and foreign key?
41.table import using command
42.indexing
43.what are keys?
44.explain different types of keys.(super,candidate,primary,foreign,alternate,composite)
45.where clause
46.operators we can use with where(=,<>/!=,<,<=,>,>=,and,or,between,like,not like,in,not in,)
47.wildcard matching operators(like)
48.searching multiple values(in)
49.for handling null values(is null,is not null)
50.limit and offset
51.what is an aggregate function
51.count(),count() with distinct
52.min(),max(),avg(),sum()
53.alias,alias with where problem
54.order of execution of sql query
55.what is subquery?is it working?Why subqueries?
56.types of subqueries

monday+tuesday->subqueries questions+group by+joins


wednesday->union & cases,advance functions,cte,views,temp tables
thursday->window function+stored procedure

use c12;
LOAD DATA INFILE '/Users/ritikraushan/Downloads/roles.csv'
INTO TABLE roles
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 LINES;
desc empsalary;
alter table empsalary add constraint check(age>18);
alter table empsalary modify column age int not null/default/unique;
insert into empsalary (age) values (17);
select * from empsalary;
desc empsalary;
-- emp->id,name,city_id
-- city->city_id,name
create table city(
city_id int,
city_name varchar(20),
primary key(city_id)
);
alter table city modify column city_id int auto_increment;
desc city;
drop table city;
create table emp(
emp_id int primary key,
name varchar(20),
city_id int,
foreign key(city_id) references city(city_id)
on update cascade
on delete cascade
);
insert into city (city_name) values ("delhi"),("pune"),("jaipur"),("hyderabad"),("goa");
select * from city;
insert into emp values (1,"virat",1),(2,"rohit",2),(3,"rishabh",1),
(4,"sachin",3),(5,"siraj",4),(6,"dhoni",5);
select * from emp;
select name,city_name from city join emp using(city_id);
update city set city_id=6 where city_id=1;
delete from city where city_id=6;
select * from city where city_name not in ("pune","jaipur");
select * from city where city_name!="pune" or city_name<>"jaipur";
select * from city;
insert into city (city_id) values (10),(11),(12);
select * from city where city_name is not NULL;
select * from city where city_name like "__n_";
select max(city_id) as maxi where city_id<maxi;
select (select max(city_id) from city),city_name from city;
select initcap("the old man");

You might also like