1.
Create a Database named – School
Solution
➢ Open LibreOffice Base .
➢ Choose Create a new database in the setup wizard
and click Next .
➢ Select Database Type
➢ Save the database – in the save as dialog Enter
SCHOOL as the database name
➢ Choose Yes , register the database for me
(optional), and click Finish.
2. Write steps to Create a table Student in Design
view with following details.
Field Name Field Type
Admno TINYINT(Primary key )
Name TEXT
Address TEXT
Class TEXT
Sec TEXT
DOB DATE
StreamID TINYINT ( FOREIGN KEY )
Solution –
➢ Open LibreOffice Base and open School
database.
➢ In the Tables section of the database window,
click Create Table in Design View.
➢ Enter each field’s name, type, and details
➢ Set Field Lengths
➢ To set primary key - Right-click the Admno
field and select Primary Key to set it as the
primary key
➢ Set foreign key on streamID
➢ Click File > Save .
.
3. Create a table Stream with following details:
FIELD NAME FIELD TYPE
StreamID TINYINT (primary key)
StreamName TEXT(25) [Use to store
stream – Medical ,
non medical
commerce and arts )
Solutions
4. Open LibreOffice Base or open existing base
5. Go to Tables in the left sidebar and select Create
Table in Design View.
6. Set streamID as primary key by clicking on the
row for streamID
7. Right click and select primary key
8. Save the table with name stream .
4. Consider the following table named “GARMENT”.
Write SQL command of SQL for (i) to (iv)
k
(i) To display names of those garments that are
available in ‘XL’ size.
SELECT GName FROM GARMENT WHERE Size
= 'XL';
(ii) To display codes and names of those
garments that have their names starting with
‘Ladies’.
SELECT GCode, GName FROM GARMENT
WHERE GName LIKE 'Ladies%';
(iii) To display garment names, codes and prices
of those garments that have price in the
range 1000.00 to 1500.00. Both values are
included.
SELECT GName, GCode, Price FROM
GARMENT WHERE Price BETWEEN 1000.00
AND 1500.00;
(iv) To change the colour of garment with code as
116 to “Orange”.
UPDATE GARMENT SET Colour = 'Orange'
WHERE GCode = 116;