You are on page 1of 4

10015328

Margaret boadi-tackie
Define data definition language and data manipulation language
SQL is a language that splits neatly into two parts. There is the Data Definition Language
(DDL) section and the Data Manipulation Language (DML) section. The Data Definition
Language (DDL) is used to create and destroy databases and database objects such as
tables. These commands will primarily be used by database administrators during the
setup and removal phases of a database project. In practice, people often use a GUI for
creating tables and so on, so it is less common to hand-write DDL statements than it used
to be. The DML section is used to manipulate the data such as querying it. Data
manipulation language comprises the SQL data change statements, which modify stored
data but not the schema or database objects. Data manipulation language is that
of Structured Querying Language (SQL), which is used to retrieve and manipulate data in
a relational database.
What commands falls under each of them.
The commands the fall under DDL are:
CREATE
The CREATE command can be used to establish each of these databases on your
platform. For example, the command:
CREATE DATABASE employees.
It creates an empty database named "employees" on your DBMS.
ALTER
The ALTER command allows you to make changes to the structure of a table without
deleting and recreating it. For example, the command:
ALTER TABLE personal_info
ADD salary money null
This example adds a new attribute to the personal_info table -- an employee's salary.
DROP
DROP, allows us to remove entire database objects from our DBMS. For example, if we
want to permanently remove the personal_info table that we created, we'd use the
following command:
DROP TABLE personal_info
The command below would be used to remove the entire employees database:
DROP DATABASE employees
The commands that fall under DML are:
INSERT
The INSERT command in SQL is used to add records to an existing table. The command
is: INSERT INTO.VALUES

.
SELECT
It allows database users to retrieve the specific information they desire from an
operational database. The command is: SELECTFROM.
UPDATE
The UPDATE command can be used to modify information contained within a table,
either in bulk or individually. The command is:
UPDATE..SET.WHERE.
DELETE
The DELETE command with a WHERE clause can be used to remove his record from
the personal_info table:
DELETE FROM ..WHERE.....
FIND THE COMMAND TO MYSQL FROM THE COMMAND PROMPT
C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld
GIVE EXAMPLES OF OTHER SYNTAX UNDER DATA MANIPULATON
LANGUAGE
INSERT
The INSERT command in SQL is used to add records to an existing table. Let's imagine
that our course rep needs to add a new member to their database. They could use a
command:
INSERT INTO personal_info VALUES (peggy,benson,10015328)
These correspond to the table attributes in the order they were defined: first_name,
last_name and student_id
SELECT
It allows database users to retrieve the specific information they desire from an
operational database. The command below limits the attributes that are retrieved from the
database.
SELECT last_name
FROM personal_info
This command list of the last names of all students in the class.
The WHERE clause can be used to limit the records that are retrieved to those that meet
specified criteria. The command is:
SELECT last_name
FROM personal_info
WHERE last_name= benson
DELETE
The DELETE command with a WHERE clause can be used to remove his record from
the personal_info table:

DELETE FROM personal_info


WHERE student_id = 10015328.
SYNTAX FOR FINDING OUT INSTRUCTOR FOR A PARTICULAR COURSE
SELECT.. FROM WHERE .
WRITE A STATEMENT TO FIND OUT THE NUMBER OF STUDENTS IN
TOTAL AND EACH REGISTERED TO A COURSE USING THE SQL
STATEMENT COUNT
SELECT COUNT * ASFROM..WHERE.
CREATE AN ERP FOR HOSPITAL
An ERD is a data modeling technique that can help define business processes and can be
used as the foundation for a relational database.

Name

Card #
number

Name

Address

Address

Doctor

Patient

License#
History

Current

Prognosis
Illness

CREATE DATABASE IT Evening;


i.
CREATE TABLE student (
Student name VARCHAR (20) NOT NULL;
DOB
DATE (10) NOT NULL;
ID NO
INTEGER (10) NOT NULL;
HEIGHT
INTEGER (2) NOT NULL;
GENDER
CHAR
(2) NOT NULL;
);
ii.
CREATE TABLE instructor (
Name
VARCHAR (15) NOT NULL;

Gender
CHAR
(2) NOT NULL;
Phone no
INTEGER (10) NOT NULL;
Availability BOOLEAN (5) NOT NULL;
);
iii.

CREATE TABLE course (


Course name VARCHAR (25) NOT NULL;
Course code VARCHAR (15) NOT NULL;
Location
VARCHAR (10) NOT NULL;
Credit hours INTEGER (3) NOT NULL;
Instructor id VARCHAR (10) NOT NULL;
Schedule
INTEGER (3) NOT NULL;
);

iv.

CREATE TABLE location(


Hall
Name of class
Number of seats
Availability
Light
);

VARCHAR (10) NOT NULL;


VARCHAR (10) NOT NULL;
INTEGER (50) NOT NULL;
BOOLEAN (5) NOT NULL;
INTEGER (7) NOT NULL;

You might also like