Basic SQL Queries with syntax
A query is a command used to interact with a database. When you interact with a MySQL database, queries are written in the SQL language.
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%’.
Inserting an object:
Updating an object: