How to Check If a Record Exists in MySQL
MySQL contains data to provide you with a way to create a dynamic website. You use a "select" statement to query the server and identify if a record exists. You use this type of command to ensure you do not enter duplicate records in a table. The select statement is run from the MySQL "Query Browser" utility.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "MySQL" and then click "Query Browser." The SQL editor opens.
-
2
Type the select statement to search for the MySQL record. For instance, the following code searches for the customer named "Jane Doe":
select * from customers where name='Jane Doe'
-
-
3
Click "Execute" at the top of the window. The code executes, and the record displays at the bottom of the window, if it exists.
-
1