admin

Update join

Update join is updating data in one table based on data in another table. The UPDATE statement examines each row of table t2 for each row of table t1. If the value in column c2 of table t1 is equal to the value in column c2 of table t2, the UPDATE statement updates the value Update join

Insert

Insert is adding a new row to the desired column in the table. **Column1, column2 .. The expressions indicate column names to be added. **value1, value2 ..         The expressions indicate the values to be added to these columns. **Columns list and values lists must be in the same order. Example: In the examples below, Insert

Delete

Deleting rows from a table. Deletes all data in the table. It produces quite a bit of WAL on large tables. So, it does IO. It is important to use a WHERE condition. DELETE FROM film_rating WHERE rating = ‘G’ returning * ; The query deletes the rows with a value of ‘G’ in the Delete

Sub-Queries

Example: We can get the list of films with the rental_rate higher than the average rental rate in two steps. 2. In the second query, using this WHERE condition with AVG(rental_rate) value we found, we can list the films  above the average. In this way, instead of using two steps, it is possible to reach Sub-Queries

Any Operator

Compares a value with a set of values returned by a subquery. Example: The following query lists the maximum length of the films by category. You can use this query as a subquery in the following expression that finds films whose lengths are greater than or equal to the maximum length of any film category. Any Operator

Union

An operator that combines the result sets of two or more SELECT statements into a single result set. To combine the result sets of two queries using the UNION operator, the queries must conform to the following rules. 1) The number and order of columns in the select list of both queries must be the Union

Intersect

The union operator is used to combine the result sets of more than one select query. In another operator, such as intersect, only the same rows in the tables are printed once.

Except

With this operator, the results that are in the table written in the first select query and not in the other select statement are printed.

JOIN

INNER JOIN is used to select/join related values from two or more tables. In summary, the SQL INNER JOIN statement is used to join tables with a common value. Two tables are included in the query. It is a query that compares the customer_id value in the customer table with the customer_id values in the JOIN

Group by

GROUP BY groups the data fetched by SELECT The query finds the customer_id values in the payment table, collects the ‘amount’ values of those with the same customer__id value, and groups them according to the customer_id. In other words, it returns the sum of the amount values of the rows with a specific customer_id value. Group by