Q 3

I) 1. List out the data types in Sybase

2. State true or false:

a) char for storing fixed-length string

b) varchar for variable –length string

c) nchar for variable –length ,multi-byte character string

d) text for large binary strings

3. State the following:

a) Single table can have only two timestamp columns

b) Image data types can store upto 2KB of image data per row

c) By default ,Sybase treats the date in the format as ‘mdy’

d) Logical data type of bit permit null values and may not be indexed

4. Answer the following:

a) Minimum value of tinyint

b) Storage size of int is _ _bytes

c) A float column with a precision of 1 to 7 is stored as _____in ____bytes

d) Storage size of money data types is

5. What is the difference between decimal data types and Float data types

II) Under consideration is the database of naval ships that took part in World War II. The database has the following relations:


Ships in classes are arranged to a single project. A class is normally assigned the name of the first ship in the class under consideration (head ship); otherwise, class name does not coincide with any ship name in the database).
The relation Classes includes the class name, type (bb for a battle ship, or bc for a battle cruiser), country the ship was built, number of main guns, gun caliber (diameter of the gun barrel, in inches), and displacement (weight in tons). The relation Ships includes the ship's name, its class name, and launch year. The relation Battles covers the name and date of the battle the ships participated; while the result of their participation in the battle (sunk, damaged, or unharmed - OK) is in the relation Outcomes. Note: the relation Outcomes may include the ships not included in the relation Ships.

1. Find the names of headships sunked in battles

2 .Find the names of the ships having the gun caliber of 16 (taking into account Outcomes table)

49ans: select name from ships where class in(select class from classes where bore=16) union select ship

from outcomes where ship in(select class from classes where bore=16)

3. Find the battles in which Kongo-class ships took part.

50ans: select o.battle from outcomes o where o.ship in (select s.name from ships s where o.ship=s.name

and s.class='kongo')

4. Find the countries having classes of both ordinary ships and cruisers

38 ans: select country from classes where type='bc' and country in (select country from classes where

type='bb') union select country from classes where type='bc' and country in (select country from classes

where type='bb') and class in(select ship from outcomes)

No comments: