SQL Basic Interview Questions:

SQl interview questions:
1).
How to create the database in sql ?
create database database_name1;
use database_name1



3).









2).How to create the table in sql ?
create table emp_details (id int, name varchar(255),place varchar(255),
salary int);



How to create the add or insert the rows into table?
insert into emp_tour (id ,name,place,salary)
values ('40', 'anna','chennai','79900');
insert into emp_tour(id,name,place,salary)
values ('90', 'roja','us','60000');
insert into emp_tour(id,name,place,salary)
values ('70','pooja','london','45000');
insert into emp_tour(id,name,place,salary)
values ('70','pooja','london','45000');

insert into emp_tour(id,name,place,salary)
values ('70','selvam','rusia','450000');




4).How to view the table in sql?

select * from emp_tour;

5).
How to fetch the all data from employee table?
select * from emp_tour;
in this way we can fetch the all details
6)..
I want to view the name of the employess from employee table ?
so how can i view?
select name ,place from table_name;
select name,place from emp_tour;

7).How to get the lowest and hightest salary value in sql?
select MAx(salary),min(salary) from table name ;
select Max(salary), Min(salary) from emp_tour;

8).
How can i fetch the distinct record into this table?
How to display the duplicate values from tables?

How to delete the duplicate data from table ?
select distinct name from table_name 




9).
How to display the lowest and highest salary  for each department ?
using orderby and desc comamnd in sql
or 
seelct max(salary), min(sslary) from table_name;

10)..
How can we filter the record or data from the table ?
select * from emp_tour where id = '10'
who is salary is greather then 100000?
sleetc * from emp_tour where salary > = 100000;

11). How to decending and ascending the data  using order by comamnd in sql?(How to sort the record )?

aasecding = arrange to smallest to highet
dec = aargge to highest to smallest
select * from table name order by salary ;
select * from table_name order by salary DESC;


12).How to modify(rename)  or update the table in sql?
How to rename the table ?
alter table oldtable name rename newtable name
13).backup database in sql:
backup database nandhini
to disk = 'directory name';




Comments

Popular posts from this blog

SQL Interview Questions:

Linux interview questions