Page 87 - Computer Software Application TP - Volume 1
P. 87

COMPUTER SOFTWARE APPLICATION - CITS



           EXERCISE 23 : Using the DDL, DCL, DML statements


            Objectives

            At the end of this exercise you shall be able to
           •  use DDL statements create,alter and drop
           •  use DCL statements grant & revoke
           •  use DML statements insert update delete

           Requirements

           Tools/Materials

           •   Desktop/Laptop with latest configuration
           •   Operating system: window 10:11
           •  XAMPP server r3.3.0


           Procedure

           TASK 1 :Accessing MySQL:

           MySQL Workbench: Download and install the graphical user interface (GUI) for MySQL management.
           Command Prompt: Open the Command Prompt and navigate to the MySQL installation directory (e.g., C:\
           Program Files\MySQL\MySQL Server 8.0\bin).
           Connecting to the Database:

           MySQL Workbench: Provide your server hostname, username, password, and database name to connect.
           Command Prompt: Use the mysql command followed by your credentials (e.g., mysql -h localhost -u root -p).

           TASK 2 :Using DDL (Data Definition Language) Statements:
           1  Create a Database:

           CREATE DATABASE your database name;
           Use the Database:
           USE your database name;
           Create a Table:
           2  CREATE TABLE employees (
                                      id INT AUTO INCREMENT PRIMARY KEY,

                                     name VARCHAR(100),
                                      salary DECIMAL(10, 2)
           );
           3  Alter Table (Add a Column)

           ALTER TABLE employees
           ADD COLUMN hire date DATE;











                                                           72
   82   83   84   85   86   87   88   89   90   91   92