
Understanding SQL: Query Language for Database Management
Learn about SQL, MySQL, and the structured query language. Explore how to select, insert, create, update data in tables, and use WHERE and LIKE clauses in SQL queries. Dive into examples and practical applications of SQL commands for effective data retrieval and management.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
- 4
MYSQL MySQL ( : [ma skju l]) https://www.mysql.com/
SQL. SQL ( s kju l; . structured query language ) , , . SQL - , , , . SQL , - , SQL/PSM .
SQL. . SELECT INSERT CREAT UPDATE
SQL. . SELECT SELECT * FROM table_name; , SELECT column1, column2 FROM table_name; , column1, column2
SQL. . SELECT SELECT Country FROM Customers; Number of Records: 91 Country Germany Mexico Mexico UK Sweden
SQL. . SELECT-DISTINCT SELECT distinct Country FROM Customers; Number of Records: 21 Country Germany Mexico UK Sweden France Spain Canada
SQL. . SELECT-WHERE SELECT column1, column2, ... FROM table_name WHERE condition;; SELECT * FROM Customers WHERE Country='Mexico'; CustomerID CustomerName ContactName Address City PostalCode Country 2 Ana Trujillo Emparedados y helados Ana Trujillo Avda. de la Constituci n 2222 M xico D.F. 05021 Mexico 3 Antonio Moreno Taquer a Antonio Moreno Mataderos 2312 M xico D.F. 05023 Mexico 13 Centro comercial Moctezuma Francisco Chang Sierras de Granada 9993 M xico D.F. 05022 Mexico 58 Pericles Comidas cl sicas Guillermo Fern ndez Calle Dr. Jorge Cash M xico D.F. 05033 Mexico 321 80 Tortuga Restaurante Miguel Angel Paolino Avda. Azteca 123 M xico D.F. 05033 Mexico
SQL. . SELECT-WHERE select !!!!
SQL. . SELECT-WHERE WHERE , , SELECT * FROM Customers WHERE CustomerID=1; =, !=, >,<, <=, >= SELECT salary FROM `staff` where salary!=60000
SQL. . SELECT.LIKE. LIKE % -1 SELECT * FROM table WHERE column LIKE '% %' SELECT * FROM table WHERE column LIKE ' %' SELECT * FROM table WHERE column LIKE '% ' SELECT * FROM testtable WHERE name NOT LIKE _____k'; _ ( -1 )
SQL. . SELECT.LIKE. REGEXP SELECT ... WHERE fieldname REGEXP 'pattern'; SELECT * FROM `movies` WHERE` title` REGEXP '^ [abcd]';
SQL. . SELECT.WHERE. AND, OR and NOT 1 , 2 NOT, 3 AND, 4 OR.
SQL. . SELECT.WHERE. AND, OR and NOT 1 , 2 NOT, 3 AND, 4 OR.
SQL. . SELECT.WHERE. AND, OR and NOT 1 , 2 NOT, 3 AND, 4 OR.
SQL. . SELECT.WHERE. AND, OR and NOT SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 AND condition3 ...;
SQL. . SELECT.WHERE. AND, OR and NOT 20 21 . SELECT PM_ID, Pname FROM Product WHERE (PM_ID = 20 OR PM_ID = 21) AND Color = 'Red
SQL. . SELECT.WHERE. AND, OR and NOT 21, 20, AND OR. SELECT PM_ID, Pname FROM Product WHERE PM_ID = 20 OR PM_ID = 21 AND Color = 'Red' SELECT ProductID, ProductModelID FROM AdventureWorks2008R2.Production.Product WHERE ProductModelID = 20 OR (ProductModelID = 21 AND Color = 'Red')
SQL. . SELECT.WHERE. AND, OR and NOT SELECT salary FROM `staff` where salary<60000 and salary>30000 SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='M nchen'); The following SQL statement selects all fields from "Customers" where country is NOT "Germany" and NOT "USA": Example SELECT * FROM Customers WHERE NOT Country='Germany' AND NOT Country='USA';
SQL. . SELECT.WHERE. AND, OR and NOT SELECT salary FROM `staff` where salary<60000 and salary>30000 SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='M nchen'); The following SQL statement selects all fields from "Customers" where country is NOT "Germany" and NOT "USA": Example SELECT * FROM Customers WHERE NOT Country='Germany' AND NOT Country='USA';
SQL. . SELECT.WHERE. . . SELECT MIN(Price) FROM Products; MIN(Price) 2500 SELECT MIN(Price) AS SmallestPrice FROM Products; SmallestPrice 2.5
SQL. . SELECT.WHERE. SELECT CustomerID AS ID, CustomerName AS Customer FROM Customers; SELECT CustomerName AS Customer, ContactName AS [Contact Person] FROM Customers;
SQL COUNT(), AVG() and SUM() Functions SELECT AVG(Price) FROM Products; AVG(Price) 28.866363636363637
SQL COUNT(), AVG() and SUM() Functions SELECT AVG(Price) FROM Products; AVG(Price) 28.866363636363637