How to Show all records starting with the letters ‘sonia’ AND the phone number ‘9876543210’

How to Show all records starting with the letters ‘sonia’ AND the phone number ‘9876543210’

mysql> SELECT * FROM tablename WHERE name like “sonia%” AND phone_number = ‘9876543210’;

To retrieve records in MySQL that start with the letters ‘sonia’ and have the phone number ‘9876543210’, you can use the SELECT statement with the LIKE operator for the name and a simple equality condition for the phone number. Here’s an example query:

sql
SELECT * FROM your_table_name
WHERE name LIKE 'sonia%' AND phone_number = '9876543210';

Make sure to replace your_table_name with the actual name of your table. The % symbol in the LIKE clause is a wildcard that matches any sequence of characters, so LIKE 'sonia%' will match any name starting with ‘sonia’. The phone number condition ensures that the specified phone number is also present in the results.

Comments are closed.