0% found this document useful (0 votes)
11 views5 pages

Finals Reviewer

The document discusses SQL commands and concepts. It describes commands like SELECT, INSERT, UPDATE, and DELETE for retrieving, adding, modifying, and removing data from database tables. It also covers SQL concepts such as database schemas, table structures, data types, indexes, and constraints.

Uploaded by

markleoj2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Finals Reviewer

The document discusses SQL commands and concepts. It describes commands like SELECT, INSERT, UPDATE, and DELETE for retrieving, adding, modifying, and removing data from database tables. It also covers SQL concepts such as database schemas, table structures, data types, indexes, and constraints.

Uploaded by

markleoj2002
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

INSY REVIEWER • HAVING – restricts the selection of

Structured Query Language (SQL) grouped rows based on a condition.


- standard computer language for
relational database management and • ORDER BY – orders the selected rows
data manipulation. based on one or more attributes.

SQL Commands: UPDATE – modifies an attribute’s values in one


CREATE SCHEMA AUTHORIZATION or more table’s rows.
– create a database schema.
DELETE – deletes one or more rows from a table.
CREATE TABLE – creates a new table in the
user’s database schema. COMMIT – permanently saves data changes.

NOT NULL – a column will not have null values. ROLLBACK – restores data to their original
values.
UNIQUE – a column will not have a duplicate
values. =, <, >, <=, >= (Comparison operator)
– used in a conditional
PRIMARY KEY – defines a primary key for a expressions.
table.
AND/OR/NOT (Logical operator)
FOREIGN KEY – defines a foreign key for a – used in a conditional
table. expressions.

DEFAULT – defines a default value for a column SPECIAL OPERATORS:


when no value is given. BETWEEN – checks whether an attribute value is
within a range.
CHECK – constraint used to validate data in a
attribute. IS NULL – checks whether an attribute value is
null.
CREATE INDEX – create an index key for a table.
LIKE – checks whether an attribute value
CREATE VIEW – creates a dynamic subset of matches a given string pattern.
rows/columns from one or more tables.
IN – checks whether an attribute value matches
ALTER TABLE – modifies table’s definition (adds, any value within a value list.
modify, deletes attributes or constraint)
EXISTS – checks whether a subquery returns any
CREATE TABLES AS – creates new table based rows.
on a query in the user’s database schema.
DISTINCT – Limits values to unique values.
DROP TABLE – permanently deletes a table &
it’s data. AGGREGATE OPERATORS: used with
SELECT to return mathematical summaries on
DROP INDEX – permanently deletes an index. columns.

DROP VIEW – permanently deletes a view. COUNT – Returns the number of rows with non-
null values for a given column.
INSERT – inserts rows into a table.
MIN – Returns the minimum attribute value found
SELECT – selects attributes from rows in one or in a given column.
more tables or views.
MAX – Returns the maximum attribute value
• WHERE – restricts the selection of rows found in a given column.
based on a conditional expression.
SUM – Returns the sum of all values for a given
• GROUP BY – groups the selected rows column.
based on one or more attributes.
AVG – Returns the average of all values for a
given column.
LAN [Local Area Network] Switching is classified into three types:
- Group of devices connecting the
computers and other devices over a short 1. Circuit Switching
distance like office or home. 2. Packet Switching
3. Message Switching
WLAN [Wireless local area network]
- Similar to LAN with the difference that
uses wireless between devices instead of wired HTTP (Hypertext Transfer Protocol)
connection.
IP (Internet protocol or IP addresses)
CAN [Campus Area Network]
- closed corporate communication system, TCP (Transmission Control Protocol)
mobile network that may contain a private or
public. UDP (User Datagram Protocol)

MAN [Metropolitan Area Network] FTP (File Transfer Protocol)


- is typically a more extensive network
when compared to LANs but is smaller than IPv4 Address - is a 32-bit address that uniquely
WANs, connected via fiber optic cable (usually and universally defines the connection of a device
high-speed connection). to the internet. Two devices on the internet can
never have the same IP address at the same
PAN [Personal Area Network] time.
- is a type of network used personally and
usually serves one person. The address space of IPv4 is 232 or
4,294,967,296(more than 4 billion).
SAN [Storage Area Network]
- a specialized high-speed network that Binary Notation:
stores and provides access to block-level storage. 01110101. 10010101.00011101.00000010
Dotted-Decimal Notation: 117.149.29.2
VPN [Virtual Private Network]
- is a secure tool that encrypts point-to- NETWORK(N,255) ; HOST(H,0)
point Internet connection and hides the user's IP
address and virtual location. Class A:

WAN [ Wide Area Network] • 0-127


- is the most significant network type • N.H.H.H
connecting computers over a wide geographical • 255.0.0.0
area, such as a country, continent. WAN includes Class B:
several LANs, MANs, and CANs. An example of
WAN is the Internet, which connects billions of • 128-191
computers globally. • N.N.H.H
• 255.255.0.0
Networking Terms and Concepts:
Class C:
IP address or Internet Protocol is a unique
• 192-223
number that represents the address where you
• N.N.N.H
live on the Internet.
• 255.0.0.0
Node refers to a networking connection point Class D:
where a connection occurs inside a network that
further helps in receiving, transmitting, creating, or • 224-239
storing files or data. • N/A (Multicast)

Router is a physical networking device, which Class E:


forwards data packets between networks. • 240-255
• N/A (Experimental)
Switch is a device that connects other devices • 255.0.0.0
and helps in node-to-node communication by
deciding the best way of transmitting data within a
network.
INFORMATION MANAGEMENT REVIEWER TRUNCATE TABLE used to delete the data
inside a table, but not the table itself.
TRUNCATE TABLE table_name;
SQL (Structured Query Language) is a domain-
specific language used to manage and ALTER TABLE Statement is used to add, delete,
manipulate relational databases. or modify columns in an existing table. It used to
Most Important KEY SQL Commands: add and drop various constraints on an existing
table.
SELECT - Retrieves data from one or more
tables. ADD Column
ALTER TABLE table_name;
INSERT - Adds new records to a table.
ADD column_name datatype;
UPDATE - Modifies existing records in a table.
DELETE - Removes records from a table.
DROP Column
• Semicolon is the standard way to
ALTER TABLE table_name;
separate each SQL statement in database
systems that allow more than one SQL DROP COLUMN column_name;
statement to be executed in the same call
to the server.
MODIFY Column
ALTER TABLE table_name;
MYSQL STATEMENTS:
MODIFY COLUMN column_name datatype;
CREATE DATABASE STATEMENT is used to
create a new SQL database.
SQL constraints are used to specify rules for
data in a table. Limit the type of data that can go
DROP DATABASE STATEMENT is used to drop into a table.
an existing SQL database.

CREATE TABLE STATEMENT is used to create


a new table in a database.
SQL CONSTRAINTS:
NOT NULL
UNIQUE - all values in a column are different.
PRIMARY KEY
• column parameters specify the names of
the columns of the table. FOREIGN KEY

• datatype parameter specifies the type of CHECK - the values in a column satisfies a
data the column can hold (e.g. varchar, specific condition.
integer, date, etc.). DEFAULT - Sets a default value for a column if no
CREATE TABLE USING ANOTHER TABLE value is specified.

✓ A copy of an existing table can also


be created using CREATE TABLE. MYSQL QUERIES ≫≫
Query - allows users to interact with a database
and retrieve or manipulate the data stored within
it.
The SELECT statement is used to select
DROP TABLE Statement data from a database.
DROP TABLE table_name; SELECT * FROM table_name;

SELECT column1, column2, column3 FROM table_name;


The INSERT INTO statement is used to insert
new records in a table. Adds new rows to a table.
The SELECT DISTINCT statement is used
Syntax:
to return only distinct (different) values.
SELECT DISTINCT column1, column2, ...
INSERT INTO statement in two ways:
FROM table_name; 1. Specified into a column and the values
SELECT COUNT(DISTINCT Country) FROM Customers; INSERT INTO table_name (column1, column2, column3, ...)

VALUES (value1, value2, value3, ...);

The WHERE clause is used to filter records. 2. Adding values for all the columns of the
table
It is used to extract only those records that
fulfill a specified condition. INSERT INTO table_name

Example: VALUES (value1, value2, value3, ...);

Text: SELECT * FROM Customers WHERE Country = ‘Pelepens';

Numeric: SELECT * FROM Customers WHERE CustomerID = 1; NULL is a special marker used to indicate that a
data value in a database does not exist in the
database. A field with a NULL value is a field with
The AND operator displays a record if all the no value.
conditions separated by AND are TRUE. Syntax:

The OR operator displays a record if any of IS NULL and IS NOT NULL:


the conditions separated by OR is TRUE. SELECT column_names FROM table_name WHERE column_name
IS NULL;
The NOT operator displays a record if the
condition(s) is NOT TRUE. SELECT column_names FROM table_name WHERE column_name
IS NOT NULL;
Syntax:

AND SELECT column1, column2


The UPDATE statement is used to modify
FROM table_name WHERE condition1 AND condition2...; existing records in a table.
Syntax:

OR SELECT column1, column2 UPDATE Records in a Table


FROM table_name WHERE condition1 OR condition2...; UPDATE Customers

SET Customer_Name = 'Arnold Smith', City = 'LA'

NOT SELECT column1, column2 WHERE CustomerID = 100241;

FROM table_name WHERE NOT condition; UPDATE Multiple Records


UPDATE Customers

The ORDER BY clause is used to sort the result SET PostalCode = 4027
set of a query in ascending or descending order WHERE Province = 'Laguna';
based on one or more columns. The ORDER BY
keyword sorts the records in ascending order by
default. DELETE Statement removes records from a
Syntax: table based on a condition.
SELECT column1, column2, ... DELETE FROM table_name WHERE condition;

FROM table_name Delete all the records in a table; table structure,


ORDER BY column1 ASC, column2 DESC; attributes, and indexes will be intact, only the
records will be removed
DELETE FROM table_name;
The LIMIT clause is used to specify the number
of records to return. It is useful on large tables
with thousands of records. Returning a large
number of records can impact performance.
Syntax:

SELECT column_name(s)

FROM table_name

WHERE condition

LIMIT number;

OFFSET Clause
SELECT * FROM Customers

LIMIT 10 OFFSET 4;

The MIN() function returns the smallest value of


the selected column.
SELECT MIN(column_name) FROM table_name;

The MAX() function returns the largest value of


the selected column.
SELECT MAX(column_name) FROM table_name;

COUNT() function returns the number of rows that


matches a specified criterion.
SELECT COUNT(column_name) FROM table_name WHERE
condition;

AVG() function returns the average value of a


numeric column.
SELECT AVG(column_name) FROM table_name WHERE condition;

SUM() function returns the total sum of a numeric


column.
SELECT SUM(column_name) FROM table_name WHERE
condition;

You might also like