banner



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.

  1. create database  School2;    /*School2 database name */
  2. use school2;   /*use queryfor select database */
  3. Create table  Student   /* create  table_Name(Student)*/
  4. (
  5.    Batchvarchar (25) not null ,
  6.    Reg_NoVarchar  (25) primary key not null ,
  7.    Coursevarchar (20) not null ,
  8.    Name_varchar (15) not null ,
  9.    Last_Namevarchar (10) not null ,
  10.    Fahter_Namevarchar (18) not null ,
  11.    Ageint not null ,
  12.    Sexvarchar (8) not null ,
  13.    Parent_Mo_NoBigint not null ,
  14.    Student_Mo_noBigint not null ,
  15.    Nationalityvarchar (15) not null ,
  16.    Statevarchar (15) not null ,
  17.    Cityvarchar (15) not null ,
  18.    Local_Addressvarchar (30) not null ,
  19.    Pin_Codebigint not null ,
  20.    Parent_Occupationvarchar (15) not null ,
  21.    Total_Rsint not null ,
  22.    Date_ datetime
  23. );
  24. select  * from  Student;    /* select  * form means show all  data form table */
  25. 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);
  26. 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)
  27. delete from  Student where  Student_Mo_no= '9540434299' ; /* Delete  query use for delete insert  recored form table  */
  28. 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

  1. select  * from  Student where  Total_Rs=7000;     /*this quary based on  search particular details using where  clause...*/
  2. select  * from  Student
  3. where  Course = 'cs'
  4. AND  Reg_No = '776679' ;     /* AND  Operator using this quary both condition true then  value will print.*/
  5. select  * from  Student
  6. where  Last_Name = 'rajput'
  7. OR  Reg_No= '776679' ;      /* OR  Operator using this quary if any  condition will true  value will print if both are true  both value print.*/
  8. select  * from  student
  9. where  State = 'bihar'
  10. 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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel