Creating Database and Table In SQL

Create
       
The main SQL command for data defination is the Create statement that all
database management system support .
         The SQL create command which can be used to
  •    Create Database
  •    Create Table
  •    Create View
  •   Create Domain

Create Database

             The create database command is used
to create a new database in database management system . 
       

      Syntax
     Create database  <database-name>

              

                    Example:-  Create database company
   

  Create Table
                 The create table command is used  to create a new table in a database by giving it's name and declaring it's column with datatypes and constraint .


          In  a given database each and every table is identified by it's name    
Syntax


 Create table <table-name>( col_1 ,col_2,........       .............col_n);

 
Example  :-



  Create table person(

              Pid        int primary key ,

              Name    varchar(30),

              country  varchar(30),   

              );


    

        Person

   Pid            Name           Country     














No comments:

Post a Comment