Thursday, 3 May 2012

Sql Server material 2


Database:

SQL Server manages the objects in a container known as Database, where we can have multiple databases present in it, each database when created creates 2 files internally those or .mdf and .ldf file.

Syntax for creating a database:
            -CREATE DATABASE <db_name>        
-Database names must be unique within an instance of SQL Server.
-Any Object name in sqlserver can be of 1 through 128 characters

Tables:

-It is the object, which will store the information in the database in the form of rows and columns.

Syntax for creating a Table:
            -CREATE TABLE <table_name>(
             column_name1 <dtype> [width],
             column_name1 <dtype> [width],
             ………………….
             column_namen <dtype> [width])

-Table names must be unique within the database.
-Column names must be unique within the table.
-Every table can have maximum of 1024 and minimum of 1 column.

            -CREATE TABLE Bank(Custid int, Cname varchar(50), Bal decimal(7,2))


<<< Previous                                                                                                                            Next >>>  

No comments:

Post a Comment