Common MySQL Queries- Tutorialpath

Basic SQL Queries with syntax

query is a command used to interact with a database. When you interact with a MySQL database, queries are written in the SQL language.

Below are all of the common MySQL query commands as well as examples of common queries.

Common query functions

  • SELECT — used to retrieve objects from a database table
  • INSERT — used to insert new objects into a database table
  • UPDATE — used to update existing objects in a database table
  • DELETE — used to delete objects from a database table
  • FROM — used to specify the database table you wish to interact with
  • WHERE — used to filter the objects retrieved based on specified criteria
  • LIMIT — used to restrict the number of objects retrieved via a query
  • LIKE — used to perform string comparisons; the % wildcard matches any number of characters, even zero characters; e.g. to select animals whose TYPE contains “wolf”, you could use SELECT * FROM animals WHERE type LIKE ‘%wolf%’.

Selecting objects:

Inserting an object:

Updating an object:

Deleting objects:

 

Leave a Reply

Your email address will not be published.