Friday 29 January 2016

SQL2- Table Creation in SQL server/Database Management System

A database consist of Tables, A table contain rows and columns, Columns contains the related information of specific item. A row contains columns information.

 In database, Columns are also known as "field" and rows as "records".
                    
      Lets create our first database which will contain one table with the name "Users_Table".
  • Open SQL server that you have installed on your machine. The first Screen looks like this.
      

  •  Enter your server name and the click on "connect".
  • after connecting your database engine right click on Databases in the object explorer. 


  • Enter your new database name, suppose we are creating our database with the name "User_Registration".
 


  • Under the databases folder our new database is created with the name "User_Registration".
  • Expand the User_Registration database in which our database contains the folder "Tables".
  • Right click on Tables and click on Table to create new table.



  • Now enter the desired column name under which you want to store your data.
  • Here we created four columns. These columns will contain related data with the name specified.


  • Whenever you create the table you must put first column for "id" and set "Primary Key" on id by right clicking on the id. id is a unique identifier because we set "Primary Key" on it which identify each individual record or row in a table.
  • id should have a data type integer (int).
  • Notice that other columns field contain data type "varchar(50)". varchar specify that every type of data can be input in the field either numeric values or either alphabetic values.
  • where 50 is the size of field. it can contain 50 characters.
  • One more important thing to be notice that at a time when you set primary key on the id there must be auto increment on id. There is "columns properties" on the bottom.
  • Click on "U_id" & in the column properties there is "identity specifications". expand "identity specification" and set (is identity) to "yes".

 
Identity Specification:
  This will increment in the id automatically whenever you enter individual record.

Identity Seed:
  identity seed is the option where you can provide your desired initial number from where you want to store record.

Identity Increment:
identity increment is the option where you set a value that tells how much increment you want in every record.

 Here we start storing record in U_id with a initial value of 1 which we specify in identity seed and we put a increment of 1 in the User_id.

  • Last step is to save the table with the desired name. By pressing Ctrl+S we save it with the name "Users_Table".




Thursday 28 January 2016

SQL1- How to Create Databse in Microsoft SQL server


What is SQL Server?

SQL server is a Software From Microsoft to develop database. A database is a set of records  which we store using SQL server tools and techniques. SQL server is a database management system.

What is SQL?

SQL Stands for "Structure Query Language", is a programming language to store and manage database records. By writing SQL Queries we usually can perform four core "CRUD" operation, Which are:
  • Create __  To create the database.
  • Read __     To retrieve the records from database.
  • Update __   To update the data in database.
  • Delete __    To delete the data from database.
  SQL is very easy to learn. SQL Queries help to perform "CRUD" operations and other outstanding operations as well.

Before Creating databases, Download SQL Server  From Microsoft Official site.You can also download the setup from the following link:
                https://www.microsoft.com/en-us/server-cloud/products/sql-server/

 After download and installing SQL server now we are able to work with SQL server and can create the database. In the next tutorial we will create our first database using SQL Server.