answersLogoWhite

0

What is procedure to create a table in sql?

Updated: 8/17/2019
User Avatar

Wiki User

15y ago

Best Answer

We can create a table in sql using CREATE TABLE command.CREATE TABLE is having a complex syntax. Few examples on how to create a table are listed below

CREATE TABLE tablename

(

Fieldname1 datatype,

Fieldname2 datatype,

.

.

.

FieldnameN datatype

);

Example:

create table faculty

(

fname varchar(30),

addr varchar(30),

phone char(12),

email varchar(50),

doj datetime,

sal money,

expr varchar(20)

)

If you want to make a field as key field,you can do by specifying as primary key.

CREATE TABLE tablename

(

Fieldname1 datatype primary key,

Fieldname2 datatype,

);

Example:

create table skillset

(skid int primary key,

skname varchar(15)

)

For more help on datatypes check out

http://msdn.microsoft.com/en-us/library/ms187752(SQL.90).aspx

For more help on creating table in sql checkout

http://msdn.microsoft.com/en-us/library/ms174979(SQL.90).aspx

anandmca08@gmail.com

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is procedure to create a table in sql?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you compile a PLSQL procedure?

You can do that with Sql*Plus: SQL> CREATE OR REPLACE PROCEDURE foo ... IS ... END foo; / SHOW ERRORS


What does SQL CREATE VIEW achieve?

SQL CREATE VIEW achieves the creation of a table or tables in the SQL database. One can then create tables to the purpose they desire and fill them in with information.


How do you create a table in Microsoft SQL?

create table tb (id int primary key, name varchar(10) not null, age int) tb - name of the table


Create view in SQL?

create view vw_active_employee as select * from employee where status = 'Active' after creating the view, view can be used as a table to see active employee. e.g. select * from vw_active_employee Basically we save sql as a database object, so that we can use that in future as a virtual table.


Which command is used to new table in the RDBMS?

In a relational database management system (RDBMS), the command for creating a new table is "CREATE TABLE". This is the standard in most SQL programs.


How do you create a table using another table including constraints?

If your using Ms SQL, use enterprise manager to export all scripts for a particular table in one file


What is the syntax of oracle dynamic sql?

The syntax for dynamic sql is For example if you want to create table at run time then syntax is Declare V-string varchar2(900); begin V_string:='create table ORACLE (empno number,ename varchar2(90)'); execute immediate V_string; end; /


What is hash table in sql?

temp table


What is the name of two DDL operations in SQL?

Some of the operations performed in DDL in sql are creation of table,alteration of table,truncate a table, drop a table


How a primary key is fixed in a sql table?

A primary key field in a sql table is created using the PRIMARY KEY keyword. ex: CREATE TABLE tbl_employee ( emp_num VARCHAR(10), emp_name VARCHAR(100), PRIMARY KEY (emp_num)) The above script creates a table called tbl_employee and sets the emp_num field as the primary key


What are the two major components of SQL and what function do they serve?

The Data Definition Language (DDL). This component of the SQL language is used to create and modify tables and other objects in the database. For tables there are three main commands:CREATE TABLE tablename to create a table in the databaseDROP TABLE tablename to remove a table from the databaseALTER TABLE tablename to add or remove columns from a table in the database.The Data Manipulation Language (DML) component of the SQL language is used to manipulate data within a table. There are four main commands:then,SELECT to select rows of data from a tableINSERT to insert rows of data into a tableUPDATE to change rows of data in a tableDELETE to remove rows of data from a table


What is a sql virtual table called?

A SQL virtual table is called a "view". Views are virtual tables that contain the result set of a SELECT query and can be used to simplify complex queries or provide a layer of abstraction over the underlying tables.