Here’s a fact about SQL queries: research has shown that only 3% of the entire query set which can be formulated in SQL is used to cover 90% of regular operations on the database. Another interesting and important fact is that these few queries work on all types of SQL engines available on the market.
SQL is an interface that helps the user communicate with the system’s database using queries. Here are some details about SQL queries that are used the most:
– Insert records on a table.
– Viewing all records from a table. The result of this query will be a display of all rows present in the table.
– Viewing only selected records from a table. If there is a large number of rows in a table and you don’t want all the records to show up on the screen, then SQL offers the possibility to view only selected rows.
– Deleting records from a table. This query will delete the entire row or more rows starting from a specific point.
– Changing data in existing records in a table.
– Viewing records from a table without knowing the precise details using the ‘LIKE’ operator provided by SQL.
– Using more than one condition in WHERE clause to retrieve records. You can use different conditions like AND, OR, <, > in a combination or individually in WHERE clause to find the desired rows.
– Viewing only selected columns from a table.
– Learn the structure of a table.
– Checking query performance in a database. You can use EXPLAIN before an SQL statement to obtain breakup of the timings on different parts of a query. It’s useful for learning the reason behind a slow query.
Find out more about SQL queries in this section!