IT Management (Information Technology Management) refers to the administration and oversight of an organization's technology

cadagjohnaron 3 views 64 slides Feb 27, 2025
Slide 1
Slide 1 of 64
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64

About This Presentation

IT Management (Information Technology Management) refers to the administration and oversight of an organization's technology resources, systems, and infrastructure to ensure efficiency, security, and alignment with business goals. It involves the planning, implementation, and maintenance of IT s...


Slide Content

IT 315 Advanced Database Systems

LEARNING OBJECTIVES Describe the need for database administration Identify the role of DBA Explain the DBA’s responsibilities in formulating and enforcing database policies for access privileges, security, disaster planning, and archiving Discuss the DBA’s administrative responsibilities for DBMS evaluation and selection, DBMS maintenance, data dictionary management, and training Discuss the DBA’s technical responsibilities for database design, testing, and performance tuning

INTRODUCTION to SQL 1

What is SQL ? Structured Query Language SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in relational database. SQL is the standard language for Relation Database System. All relational database management systems like “MySQL, MS Access, Oracle, Sybase, Informix, and SQL Server” use SQL as standard database language.

Applications of SQL ? SQL is one of the most widely used query language over the databases. Allows users to access data in the relational database management systems. Allows users to describe the data. Allows users to define the data in a database and manipulate that data.

Applications of SQL ? Allows to embed within other languages using SQL modules, libraries & pre-compilers. Allows users to create and drop databases and tables. Allows users to create view, stored procedure, functions in a database. Allows users to set permissions on tables, procedures and views.

SQL Commands DDL - Data Definition Language DML - Data Manipulation Language DCL - Data Control Language DQL - Data Query Language

SQL Commands

SQL Commands DDL (Data Definition Language) :  DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database.

SQL Commands Examples of DDL commands: CREATE  – is used to create the database or its objects (like table, index, function, views, store procedure and triggers). DROP  – is used to delete objects from the database. ALTER -is used to alter the structure of the database. TRUNCATE –is used to remove all records from a table, including all spaces allocated for the records are removed. COMMENT  –is used to add comments to the data dictionary. RENAME  –is used to rename an object existing in the database.

SQL Commands DQL (Data Query Language) : DQL statements are used for performing queries on the data within schema objects. The purpose of DQL Command is to get some schema relation based on the query passed to it. Example of DQL: SELECT  – is used to retrieve data from the a database.

SQL Commands DML (Data Manipulation Language) :  The SQL commands that deals with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements. Examples of DML: INSERT  – is used to insert data into a table. UPDATE  – is used to update existing data within a table. DELETE  – is used to delete records from a database table.

SQL Commands DCL (Data Control Language) :  DCL includes commands such as GRANT and REVOKE which mainly deals with the rights, permissions and other controls of the database system. Examples of DCL commands: GRANT -gives user’s access privileges to database. REVOKE -withdraw user’s access privileges given by using the GRANT command.

SQL RDBMS Concepts SQL Constraints : (applied on columns) NOT NULL Constraint UNIQUE Constraint PRIMARY Key FOREIGN Key

SQL RDBMS Concepts Data Integrity : Entity Integrity: There are no duplicate rows in a table Domain Integrity: Enforces valid entries for a given column by restricting the type Referential Integrity: Rows cannot be deleted which are used by other records

SQL RDBMS Concepts Data Integrity : Entity Integrity: There are no duplicate rows in a table Domain Integrity: Enforces valid entries for a given column by restricting the type Referential Integrity: Rows cannot be deleted which are used by other records

SQL RDBMS Concepts Exact Numeric Data Types

SQL RDBMS Concepts Date and Time Data Types

SQL RDBMS Concepts Character Strings Data Types

SQL RDBMS Concepts Unicode Character Strings Data Types

SQL RDBMS Concepts Binary Data Types

SQL Syntax 2

SQL Syntax SELECT Lname , Fname , GWA FROM Students; Retrieves all the Lname , Fname and GWA from the Students table

SQL Syntax SELECT Lname , Fname , GWA FROM Students WHERE GWA >= 1.75; Retrieves the Lname , Fname and GWA of students from the Students table whose GWA is equal or greater than 1.75

SQL Syntax SELECT DISTINCT Department FROM Students; Returns a list of unique departments, removing duplicates

SQL Syntax Using AND & OR Clauses in SQL The AND and OR clauses are used in the WHERE condition to filter data based on multiple conditions: • AND → Returns rows only if all conditions are true. • OR → Returns rows if at least one condition is true.

1. Using AND (Both Conditions Must Be True) SELECT * FROM Employees WHERE Department = 'IT' AND Salary > 50000; ✅ Retrieves employees who are in the IT department AND have a salary greater than 50,000.

2. Using OR (At Least One Condition Must Be True) SELECT * FROM Employees WHERE Department = 'IT' OR Department = 'HR'; ✅ Retrieves employees who are either in IT or HR.

3. Combining AND & OR (Using Parentheses for Clarity) SELECT * FROM Employees WHERE (Department = 'IT' OR Department = 'HR') AND Salary > 50000; ✅ Retrieves employees who are either in IT or HR, but only if their salary is above 50,000.

4. Using AND & OR with NOT SELECT * FROM Employees WHERE NOT (Department = 'Finance' OR Salary < 40000); ✅ Retrieves employees who are NOT in Finance and do NOT have a salary below 40,000.

SQL Syntax IN Clause • Used to filter rows where a column’s value matches any value in a given list. • Works with multiple values. • Typically used for discrete values (categories, names, IDs, etc.). SELECT * FROM Students WHERE Department IN (‘CCS', ‘CITD', ‘CITHM');

SQL Syntax BETWEEN Clause • Used to filter rows where a column’s value falls within a range (inclusive). •Works best for continuous values like dates or numbers. SELECT * FROM Students WHERE YOB BETWEEN ‘1995-01-01' AND ‘2010-01-31';

SQL LIKE Clause The LIKE clause in SQL is used for pattern matching in text (string) columns. It allows filtering results using wildcards (% and _) in combination with the WHERE clause. Wildcards in LIKE % Matches zero, one, or multiple characters 'A%' (Starts with A) _ Matches a single character ' J_n ' (Matches “Jan”, “Jon”, etc.)

Examples of LIKE Usage 1. Find names starting with ‘A’ SELECT * FROM Customers WHERE Name LIKE 'A%'; ✅ Retrieves names like Alice, Andrew, Adam. 2. Find names ending with ‘son’ SELECT * FROM Customers WHERE Name LIKE '%son'; ✅ Retrieves names like Jackson, Wilson, Anderson.

3. Find names containing ‘an’ anywhere SELECT * FROM Customers WHERE Name LIKE '%an%'; ✅ Matches names like Daniel, Jonathan, Anna. 4. Find names with exactly 5 letters, starting with ‘J’ SELECT * FROM Customers WHERE Name LIKE 'J____'; ✅ Matches names like James, Julia (5-letter names starting with J). 5. Find phone numbers starting with ‘123’ SELECT * FROM Contacts WHERE PhoneNumber LIKE '123%'; ✅ Retrieves numbers like 123-456-7890 and 123-987-6543. Using NOT LIKE to Exclude Patterns SELECT * FROM Customers WHERE Name NOT LIKE 'A%';

5. Find phone numbers starting with ‘123’ SELECT * FROM Contacts WHERE PhoneNumber LIKE '123%'; ✅ Retrieves numbers like 123-456-7890 and 123-987-6543. Using NOT LIKE to Exclude Patterns SELECT * FROM Customers WHERE Name NOT LIKE 'A%';

ORDER BY The ORDER BY clause in SQL is used to sort query results in either ascending (ASC) or descending (DESC) order based on one or more columns. • ASC (Default) → Sorts in ascending order (A-Z, 0-9). • DESC → Sorts in descending order (Z-A, 9-0).

Examples of ORDER BY Usage 1. Sort employees by salary (Lowest to Highest) SELECT * FROM Employees ORDER BY Salary ASC; ✅ Lists employees from lowest to highest salary. 2. Sort employees by salary (Highest to Lowest) SELECT * FROM Employees ORDER BY Salary DESC; ✅ Lists employees from highest to lowest salary. 3. Sort customers by name (Alphabetically) SELECT * FROM Customers ORDER BY Name; ✅ Retrieves customers sorted A-Z (default ASC).

4. Sort orders by date (Newest first) SELECT * FROM Orders ORDER BY OrderDate DESC; ✅ Shows the most recent orders first. 5. Sort by multiple columns (Sort by Department, then Salary) SELECT * FROM Employees ORDER BY Department ASC, Salary DESC; ✅ First sorts by Department (A-Z), then by Salary (High to Low) within each department.

GROUP BY The GROUP BY clause in SQL is used to group rows with the same values in specified columns and apply aggregate functions (like COUNT(), SUM(), AVG(), etc.) to each group. Basic Syntax SELECT column_name , aggregate_function ( column_name ) FROM table_name GROUP BY column_name ; • Groups rows with the same value in a column. • Commonly used with aggregate functions like COUNT(), SUM(), AVG(), MAX(), MIN().

Examples of GROUP BY Usage 1. Count employees in each department SELECT Department, COUNT(*) AS EmployeeCount FROM Employees GROUP BY Department; ✅ Groups employees by Department and counts how many are in each department. 2. Calculate total sales per customer SELECT CustomerID , SUM( TotalAmount ) AS TotalSpent FROM Orders GROUP BY CustomerID ; ✅ Groups orders by CustomerID and calculates the total amount spent per customer.

3. Get the highest salary per job title SELECT JobTitle , MAX(Salary) AS HighestSalary FROM Employees GROUP BY JobTitle ;

SQL Syntax

SQL Having The HAVING clause in SQL is used to filter grouped results after applying aggregate functions (like COUNT(), SUM(), AVG(), etc.). Why Use HAVING? •The WHERE clause cannot be used with aggregate functions. •HAVING is used after GROUP BY to filter grouped data based on aggregate conditions. Basic Syntax SELECT column_name , aggregate_function ( column_name ) FROM table_name GROUP BY column_name HAVING condition;

Examples of HAVING Usage Get customers who spent more than Php10,000 in total orders SELECT CustomerID , SUM( TotalAmount ) AS TotalSpent FROM Orders GROUP BY CustomerID HAVING SUM( TotalAmount ) > 10000; ✅ Returns customers who have spent more than Php10,000 in total.

Find products with an average price greater than Php50 SELECT ProductCategory , AVG(Price) AS AvgPrice FROM Products GROUP BY ProductCategory HAVING AVG(Price) > 50; ✅ Shows product categories where the average price is greater than Php50.

4. Get suppliers with at least 3 different products SELECT SupplierID , COUNT(DISTINCT ProductID ) AS ProductCount FROM Products GROUP BY SupplierID HAVING COUNT(DISTINCT ProductID ) >= 3; ✅ Lists suppliers who provide at least 3 different products.

Key Differences: WHERE vs. HAVING Clause When to Use WHERE Filters individual rows before grouping HAVING Filters groups after aggregation

SQL Syntax

SQL Syntax

SQL Syntax

SQL Syntax

OPERATORS in SQL 3

OPERATORS in SQL An operator is a reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations. These Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement. Arithmetic operators Comparison operators Logical operators Operators used to negate conditions

OPERATORS in SQL

OPERATORS in SQL

OPERATORS in SQL

OPERATORS in SQL

OPERATORS in SQL

EXPRESSIONS 4

EXPRESSIONS An expression is a combination of one or more values, operators and SQL functions that evaluate to a value. These SQL EXPRESSIONs are like formulae and they are written in query language. You can also use them to query the database for a specific set of data.

EXPRESSIONS SYNTAX There are different types of SQL expressions, which are: Boolean Numeric Date

EXPRESSIONS (Boolean)

EXPRESSIONS (Numeric)
Tags