COMPUTER 3rd Prelim
COMPUTER 3rd Prelim
Data Manipulation Language (DML) will enable you to view, filter, insert, delete, and update data in
your database.
DML is a family of computer languages that includes commands permitting users to manipulate data
in a database.
INSERT
This command adds one or more records in a database table.
This adds one or more records to a database table.
SYNTAX:
USE [database name]
INSERT INTO [table name][column(s)]
VALUES [value(s)]
Example:
USE SJS_Enrollments
INSERT INTO studentprofile
(
studentnumber,
Slastname,
Sfirstname,
Smiddlename,
)
VALUES
(
‘1008’,
‘vergra’,
‘Adrielle john’,
‘mapanoo’,
)
UPDATE
This command that will allow you to edit or modify the content of your table.
This command modifies data of one or more records.
SYNTAX:
USE [database name]
UPDATE [table name]
SET [column name = value]
WHERE [condition]
Example:
USE SJS_Enrollments
UPDATE SY_2023_2024
SET Flastname = ‘Fandivila’
WHERE Flastname = ‘Fandavilla’;
DELETE
Is another DML statement/command which will allow you to remove unnecessary data inside
your table.
SYNTAX:
USE [database name]
DELETE FROM [table name]
WHERE [condition]
Example:
USE SJS_Enrollments
DELETE FROM SPC
WHERE Age = ‘14’;
SELECT
This DML command will allow you to view contents of your table.
This command is used to retrieve rows from a table.
This command is the most widely used DML command in SQL.
SYNTAX:
USE [database name]
SELECT [column name]
FROM [table name]
WHERE [conditions]
Example:
USE SJS_Enrollments
SELECT Lastname
FROM SY_2023_2024
WHERE Lastname = ‘Fandivila’;
SYNTAX:
USE [database name]
SELECT * FROM [table name]
Example:
USE SJS_Enrollments
SELECT * FROM SY_2023_2024
Syntax:
USE [database name]
SELECT [column],[column],[column]
FROM [table name]
Example:
USE SJS_Enrollments
SELECT ID_number, Firstname, Age
FROM SY_2023_2024
VIEWING MULTIPLE COLUMNS IN ONE COLUMN
Syntax:
USE [database name]
SELECT
[column],
[column1] + ‘,’ + [column2] + SPACE(1) + [column3]
AS [new column name]
FROM
[table name]
Example:
USE SJS_Enrollments
SELECT
ID_number,
UPPER(Lastname) + ‘,’ + UPPER(Firstname) + SPACE(1) + UPPER(Middlename)
AS [Fullname]
FROM
SY_2023_2024