(1a) List Five (5) SQL commands to interact with relational databases
Answer:
CREATE, SELECT, INSERT, UPDATE, DELETE, DROP
Command
(1b)
Explain 3 in all
ANSWER: INSERT: This command is use to create record.
UPDATE: This Command is use in
modifying records.
DELETE: Deletes records.
SELECT commands: retrieves certain
records from one or more tables.
DROP: Deletes an entire table, a view
of a table or other object in the database.
CREATE: statement is used to create new SQL database
(3a)
Write a syntax for CREATE Command
ANSWER: CREATE DATABASE DatabaseName;
(3b)
Write a Create statement for (i) Toddlersaven (ii) Everest Height School
ANSWER: (i)
CREATE DATABASE Toddlersaven; (ii) (i) CREATE DATABASE EverestHeightSchool;
(4)
Write Basic syntax to CREATE TABLE in DBMS
ANSWER
CREATE
TABLE table_name(
Column
1 datatype,
Column
2 datatype,
Column
3 datatype,
Column
N datatype,
PRIMARY
KEY (one or more columns));
Note:
Column1 to column n is the field name and
its Data type
(5)
Create a table for SS2 Bio Data using: Name, Phone_Number, StudentID, Address
CREATE TABLE SS2 (
StudentID INT NOTNULL,
NAME VARCHAR (50) NOTNNULL,
PhoneNumber INT NOTNULL,
ADDRESS CHAR (25),
PRIMARY KEY (ID));
(6a)
Write Basic syntax to Deletes an entire table in DBMS
Answer:
Basic syntax of Drop Database statement is a follows:
DROP
DATABASE DatabaseName;
(7a) Write Syntax to show all record in SS2
Table
Answer:
SELECT * FROM SS2;
(8)
Write syntax to show a record “NAME” of Value “Ada” in SS2 Table
Answer:
SELECT * FROM SS2 WHERE NAME=”Ada”
(9)
Write a DROP statement to delete (i) Toddlersaven (ii) Everest Height School
Database
Answer:
DROP DATABASE Toddlersaven;
DROP
DATABASE EverestHeightSchool;
(10)
Write INSERT statement to add The following Field: 101, Adam, 08048367633 to SS2
table
Answer:
INSERT INTO SS2 values (101, ‘Adam’, 08048367633)