The quires are used to implement the problems using any database engine  using MS SQL server 2008. So here are some quires that will helpful in making any type of database. Lets we start it,

For adding new table by queries
USE CIITCLUSTER
CREATE TABLE Student
(ID INT NOT NULL PRIMARY KEY,
NAME NVARCHAR(500) NOT NULL ,
FName NVARCHAR(500) NOT NULL,
CITY NVARCHAR(500) NOT NULL,
AGE NVARCHAR(500) NOT NULL,
EMAIL NVARCHAR(500) NOT NULL)
  CREATING STUDENT TABLE  USE ITU
CREATE TABLE STUDENT
(ID INT NOT NULL PRIMARY KEY,
NAME NVARCHAR(500) NOT NULL ,
FNAME NVARCHAR(500) NOT NULL ,
CITY NVARCHAR(500) NOT NULL ,
AGE NVARCHAR(500) NOT NULL ,
CINC NVARCHAR(500) NOT NULL ,
MARKS NVARCHAR(500) NOT NULL ,
DEPARTMENT NVARCHAR(500) NOT NULL ,
COURSEID NVARCHAR(500) NOT NULL)
 

Export, Update, Delete, Search, Select and Insert data within a Database

use ciitcluster
select * from Student where ID = 2;
select * from Student where City != 'vehari';
select * from Student where Age =23 or Age = 25;
select * from Student where Age in(20,25,28);
select * from Student where Age between 20 AND 30;
select * from Student where city LIKE('%V%');
select * from Student where EMAIL LIKE('%@%');
select * from Student where EMAIL NOT LIKE('%@%');
select * from Student where Name LIKE '[NAD]%';
select * from Student where Name NOT LIKE '[NAD]%';
select * from Student where (city = 'Vehari' OR city = 'Multan') AND Age < 25;
 
This post was published by author Ghulam Mujtaba
Axact

Ciit Cluster

Ciit Cluster | the education hub... where you can download all books, software and small games and other projects and books with out any payment. Its totally free and easy to use.

Post A Comment:

0 comments: