Data is essential in an organization. So storing it in a database helps an organization to easily store it so they can retrieve it in the near future for decision-making. All information systems have the following common functions, to add or insert new record, update existing record, view list of records in the database and delete records. If you are going to create one, all you have to do is to reuse your codes since they are all the same. They just differ in the name of table, column names and variable names.
I already provided a tutorial on how to insert records in the database. This time, I will teach you how to display records from database to a table. Before you start, first create your database and table like on the picture below.
In this article, I will share with you how to search for a record in the database. Displaying the record have similar code when you want to search for a record. The only difference is you need to specify your condition in searching using the WHERE clause.
STUDENT Table
![]() |
STUDENT |
MySQL Code Search
SELECT * FROM `student` WHERE CONCAT(stud_first,stud_last) like "%ua%"
The query above will search for first name or last name with "ua" and will display below.
Search Output

SELECT * FROM `student` WHERE stud_first like "%ua%"
This will return the same output above since ua is found only on the first name Juan.
No comments:
Post a Comment