Assignment on SQL - Assignment Point
Assignment on SQL
Subject: Management | Topics:

SQL:

SQL is a special-purpose programming language designed for managing data held in a relational database management system .

Create Table Construct

An SQL relation is defined using the create table command:

create table r (A1 D1, A2 D2, …, An Dn,
(integrity-constraint1),
…,
(integrity-constraintk))

r is the name of the relation
each Ai is an attribute name in the schema of relation r
Di is the data type of attribute Ai
Example:

create table branch
(branch_name  char(15),
branch_city  char(30),
assets  integer)

Domain Types in SQL

char(n).  Fixed length character string, with user-specified length n.
varchar(n).  Variable length character strings, with user-specified maximum length n.
int.  Integer (a finite subset of the integers that is machine-dependent).
smallint.  Small integer (a machine-dependent subset of the integer domain type).
numeric(p,d).  Fixed point number, with user-specified precision of p digits, with n digits to the right of decimal point.
real, double precision.  Floating point and double-precision floating point numbers, with machine-dependent precision.
float(n).  Floating point number, with user-specified precision of at least n digits.
More are covered in Chapter 4.
Integrity Constraints on Tables
not null
primary key (A1, …, An )

Example:  Declare branch_name as the primary key for branch.

create table branch
(branch_name  char(15),
branch_city  char(30) not null,
assets  integer,
primary key (branch_name))

Download (PPT, Unknown)

SQL

Related Management Paper: