How To Create Database In Sql Server 2008 Express
- Updated date May 13, 2015
- 20.6k
- 3
Here you will learn how to create a database in SQL Server 2008.
Hello friends. Today I am sharing my article about how to create databases, create tables, insert values into tables and update, delete and so on. I know this is basic information but I know this article will be helpful for all beginner students.
You need to first install .Net and then you need to install Microsoft SQL Server, any version. I have installed SQL Server 2008 .
After installation, connect to the database as shown in the following image.
Now SQL Server is ready to create your database as shown in the following image.
- create database School2; /*School2 database name */
- use school2; /*use queryfor select database */
- Create table Student /* create table_Name(Student)*/
- (
- Batchvarchar (25) not null ,
- Reg_NoVarchar (25) primary key not null ,
- Coursevarchar (20) not null ,
- Name_varchar (15) not null ,
- Last_Namevarchar (10) not null ,
- Fahter_Namevarchar (18) not null ,
- Ageint not null ,
- Sexvarchar (8) not null ,
- Parent_Mo_NoBigint not null ,
- Student_Mo_noBigint not null ,
- Nationalityvarchar (15) not null ,
- Statevarchar (15) not null ,
- Cityvarchar (15) not null ,
- Local_Addressvarchar (30) not null ,
- Pin_Codebigint not null ,
- Parent_Occupationvarchar (15) not null ,
- Total_Rsint not null ,
- Date_ datetime
- );
- select * from Student; /* select * form means show all data form table */
- insert into student values ( 'LLB_08_2ndy' , '776678' , 'LLB' , 'Vivekanand' , 'Singh' , 'Dineshwar singh' ,23, 'Male' ,9891688420,9968022717, 'Indian' , 'Bihar' , 'Patna' , 'Ny 26A' ,800001, 'Gov job' ,90000,5/12/1986);
- insert into student values ( 'BA_1stYear' , '776683' , 'Pol Science' , 'Rajat' , 'Singh' , 'Suman Singh' ,23, 'Male' ,9565434560,9716157368, 'Indian' , 'Delhi' , 'New Delhi' , 'Mahipalpur New Delhi' ,110037, 'Businessman' ,70000,5/05/2015)
- delete from Student where Student_Mo_no= '9540434299' ; /* Delete query use for delete insert recored form table */
- update student set Date_ =04/04/2015 where Reg_No= '776678' ; /* update query use for update in existing data add new data*/
More select query using conditional expression
- select * from Student where Total_Rs=7000; /*this quary based on search particular details using where clause...*/
- select * from Student
- where Course = 'cs'
- AND Reg_No = '776679' ; /* AND Operator using this quary both condition true then value will print.*/
- select * from Student
- where Last_Name = 'rajput'
- OR Reg_No= '776679' ; /* OR Operator using this quary if any condition will true value will print if both are true both value print.*/
- select * from student
- where State = 'bihar'
- AND (Reg_No = '776678' OR Reg_No= '776679' ); /*this quary using both AND & OR Operator print value only AND Operator*/
A constraint is a condition or check for an application on a field or set of fields.
- Delete is a DML command and drop is a DDL command
- Delete is used to delete rows from a table whereas drop is used to remove the entire table or database from the database.
- Update is a DML command and alter is a DDL command
- Update is used to update data in an existing table
So friends, this is a small article that will help you with "How to Create a Database in SQL Server 2008".
Next time I will provide more interesting commands. Thank you. I Hope this is helpful for you. Enjoy, :)
Thanks in advance,
Krishna Rajput
How To Create Database In Sql Server 2008 Express
Source: https://www.c-sharpcorner.com/UploadFile/a5f59f/how-to-create-database-in-sql-server-2008/
Posted by: pattonprixed.blogspot.com
0 Response to "How To Create Database In Sql Server 2008 Express"
Post a Comment