Directions: Give an example on how to illustrate the use of the following SQL DDL Commands.
1. Create a database using the CREATE DATABASE command.
2. Create a database table using the CREATE command.
3. After a table in SQL using the ALTER command, and show how to add new column to the existing table.
4. List the content of a table using the SELECT columnist command.
5. How to update table rows using the UPDATE command.
6 Delete a database in SQL using the DROP DATABASE command.
7.Delete a table in a database.
CREATE DATABASE RUGBY;
CREATE TABLE Rugby_players(
player_id int NOT NULL AUTOINCREMENT,
name VARCHAR(45) NOT NULL,
player_position int NOT NULL,
PRIMARY KEY(player_id)
);
ALTER TABLE Rugby_players ADD age int(2);
SELECT * FROM Rugby_players;
UPDATE Rugby_players
SET name = "Richie"
WHERE player_id = 4;
DROP DATABASE RUGBY;
DROP TABLE IF EXISTS Rugby_players;
Comments
Leave a comment