Thursday, 16 January 2014

Database Important Quries

  Database Important Quries by Vijay Prakash

1>How to create database?
ans:-create database databasename.
2>How to use database
ans:-use databasename.
3>How to see the database.
ans:-show databases.
4>How to drop the database?
ans:-delete database databasename.
5>How to create table?
ans:-create table tablename(fieldname datatype,................................);
6>How to insert the values inside the table?
ans:- insert into tablename values('values','values',...............................);
7>How to drop table?
ans:-drop table tablename.
8>How to see the table.
ans:-select * from tablename.
9>How to see record the particuler table values?
ans:-select * from tablename where columnname="values".
10>How to modified the table?
ans:-update tabename set columnname1='values', columnname2='values' where='values'.
11>How to delete column values inside the table?
ans:-delete from tablename where columnname='values';
12>How to work like just like = operator query DELETE SELECTE UPDATE INCLUDE '%'
ANS:-SELECT * from tablename where columnname like '%s';
just like select update delete
13>How to work order by asc and desc
ans:-select * from tablename order by columnname asc;
14>How to work is null and null operator; = relation is and is not relation !=;
ans:-select * from tablename where columnname=null;
select * from tablename where columnname !=null;
select * from tablename where columnname is null;
select * from tablename where columnname is not null;
15> How to work REGEXP just like like operator
like --%
regexp '^s'; $ etc.
ans:-select * from tablename where name regexp '^s';
select * from tablename where name regexp '$s';
16>How to drop column in the table?
ans:-alter table tablename drop column;
17>How to add column in the table?
ans:-alter table tablename add column datatype;
18>How to column add drop in perticuler position in the table;
ans:-alter table tablename add name varchar(34) first;
alter table tablename add name varchar(34) after;
19>How to changing a column definition datatype size?
ans:-alter table tablename MIDIFY columnname datatype(size);
20>How to changing the columnname inside the table?
ans:-alter table tablename CHANGE roll id int;
21>How to change the default size inside the table;
ans:-alter table tablename alter roll set default 100;
22>How to drop default size in the table?
ans:-alter table tablename alter roll drop default;
23>How to rename table?
ans:-alter table tablename rename to newtablename;
24>How to check the table status?
ans:-show table status like 'tablename'\g;
java mai reserved key word kya hai
generic, cast, and threadsafe








No comments:

Post a Comment