
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Delete a specific record from a MySQL table by using AND in WHERE clause
MySQL AND is used in WHERE to fetch a record by filtering using multiple conditions. Let us first create a table−
mysql> create table DemoTable -> ( -> Id int, -> Name varchar(20) -> ); Query OK, 0 rows affected (0.70 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(101,'Chris'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(102,'David'); Query OK, 1 row affected (0.51 sec) mysql> insert into DemoTable values(103,'Bob'); Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable;
This will produce the following output −
+------+-------+ | Id | Name | +------+-------+ | 101 | Chris | | 102 | David | | 103 | Bob | +------+-------+ 3 rows in set (0.00 sec)
Here is the query to delete a record −
mysql> delete from DemoTable where Id=102 and Name='David'; Query OK, 1 row affected (0.20 sec)
Let us check the table records once again −
mysql> select * from DemoTable;
This will produce the following output −
+------+-------+ | Id | Name | +------+-------+ | 101 | Chris | | 103 | Bob | +------+-------+ 2 rows in set (0.00 sec)
- Related Articles
- How can you delete a record from a table using MySQL in Python?
- Can we select second largest record from a table without using LIMIT clause in MySQL?
- How to delete last record (on condition) from a table in MySQL?
- Delete a specific record on the basis of EmployeeId in MySQL
- Delete only specific rows in a table with MySQL
- Delete records from a MySQL table by excluding non-deleted records using NOT IN
- Display specific name from a table with repeated individual FirstName and LastName using LIKE clause twice
- DELETE from MySQL table WHERE column equals value AND column2 equals value2?
- Delete all records from a table in MySQL?
- Delete multiple entries from a MySQL table
- Delete more than one rows from a table using id in MySQL?
- MySQL automatic string to integer casting in WHERE clause to fetch a specific id
- How to search a record by date in MySQL table?
- Fetch a specific record using a single MySQL query with AND & OR operator
- Delete a record with tablename.columnname= value in MySQL

Advertisements