Download presentation
Presentation is loading. Please wait.
Published byClarence Fowler Modified over 8 years ago
1
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, frmcclurg@gmail.com Copyright © 2016, Fred McClurg, All Rights Reserved.
2
Chapter Eight MySQL Wildcards http://cecert.kirkwood.edu/~fmcclurg/courses/ph p/slides/chapter08c.wildcards.ppt 2
3
Description: Searching records in a database often involves matching part of string in a field. Percent Character (%): Wildcard that matches zero or more characters and is used with keyword “LIKE”. Example: SELECT * FROM recipe WHERE FROM recipe WHERE (content LIKE "%rubarb%" AND (content LIKE "%rubarb%" AND content LIKE "%strawberr%"); content LIKE "%strawberr%"); Search Function with “%” Wildcard 3
4
Search Function Example Using “%” 4
5
Description: The keywords AND, OR and NOT can be used in the WHERE clause to combine multiple statements. Examples: SELECT r.name AS 'Title', c.name AS 'Type' c.name AS 'Type' FROM recipe AS r, FROM recipe AS r, category AS c category AS c WHERE ( WHERE ( r.name LIKE '%chocolate%' OR r.name LIKE '%chocolate%' OR r.name LIKE '%cocoa%' ) AND r.name LIKE '%cocoa%' ) AND c.name = "Dessert" AND c.name = "Dessert" AND r.category_id = c.id; r.category_id = c.id; Logical Operators 5
6
Logical Operator Example 6
7
Description: Searching records in a database often involves matching part of string in a field. Underscore Character ( _ ): Wildcard that matches exactly one character and is used with keyword “LIKE”. Example: SELECT id, name FROM recipe WHERE FROM recipe WHERE name LIKE '_______'; # 7 name LIKE '_______'; # 7 Search Function with “ _ ” Wildcard 7
8
Search Function Example Using “ _ ” 8
9
to be continued... http://cecert.kirkwood.edu/~fmcclurg/courses/p hp/slides/chapter08d.functions.ppt9
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.