Followers

EXE -11 To create simple tables , with only the primary key constraint ( as a table level constraint & as a field level constraint) (include all data types)




Create database:


1  -  Create a table with details as given below Table Name=> PLAYER


Columns

Column Name

Column Data Type

Constraints

1

player_id

Integer

Primary key

2

Name

varchar (50)

 

3

Birth_date

date

 

4

Birth_place

varchar(100)

 



Table level constraint-No

Ans.
create table player(
player_id integer primary key,
name varchar(50),
birth_date date,
birth_place varchar(100)
);
player;

 ----------------------------------------------------------------------------------------------------------------------------


2 - Create a table with details as given below  Table Name=> Student


Columns

Column Name

Column Data Type

Constraints

1

Roll_no

integer

 

2

Class

varchar (20)

 

3

Weight

numeric (6,2)

 

4

Height

numeric (6,2)

 

 

Table level constraint=> Roll_no and class as primary key


Ans.
                 create table student(
Roll_no integer,
class varchar(20),
Weight numeric(6,2),
Height numeric(6,2),
primary key(Roll_no,class)
);

---------------------------------------------------------------------------------------------------------------------------- 



3 -  Create a table with details as given below  Table Name Project


Columns

Column Name

Column Data Type

Constraints

1

project_id          

integer

Primary key

2

Project_name

varchar (20)

 

3

Project_description

text

 

4

Status

Boolean

 

Table level constraint

Ans:
create table project(
id integer primary key,
name varchar(20),
description text,
status boolean
);
project;
---------------------------------------------------------------------------------------------------------------
         Set-B

1] Create table for the information given below by choosing appropriate data types and also
specifying proper primary key constraint on fields which are underlined

 1. Property ( PROPERTY_ID-pk, property_desc , area, rate, agri_status )
 2. Actor ( actor_id-pk, Actor_name, birth_date )
 3. Movie(movie-no-pk, name, release-year )
 4. Hospital(hno-pk,hname,hcity)


 Ans.
 1]
 create table property(
 id integer primary key,
 descr text,           
 area text,
 rate integer,
 status boolean
 );
 2]
 create table actor(
 id integer primary key,
 name text,
 dob date
 );
 3]
 create table movie(
 no int primary key,
 name text,
 ryear integer
 );
 4]
 create table hospital(
 hno int primary key,
 hname text,
 hcity text
 );

  1. It's saying missing right parenthesis

    ReplyDelete
    Replies
    1. This comment has been removed by a blog administrator.

      Delete
    2. Please copy the code with all the parenthesis

      Delete

EXE -11 To create simple tables , with only the primary key constraint ( as a table level constraint & as a field level constraint) (include all data types)

Create database: 1  -  Create a table with details as given below  Table Name=> PLAYER Columns Column Name ...