In this example, a user gets a single number that is equal to the average value of the quantities contained in the price column of the titles table.
The sampling command SELECT is capable of sampling more than one table by linking data with the aid of primary and secondary keys. Data grouping commands and some other capabilities exist. Consideration of these is however beyond the scope hereof. The literature on the query language is abundant so anyone with an interest in this will have no problems with finding the information he or she needs.
INSERT is the command used to insert data into a database. Here is one example of how values can be inserted into the F_name, L_name, U_login and U_password columns in the Users table:
INSERT INTO Users (F_name, L_name, U_login, U_password)
VALUES ('Сергей', 'Иванов', 'Sergey', 'HM235YPAH')
The key words used here are INSERT INTO followed by the table name and a bracketed list of the fields inserted. The further key word is VALUES, which is followed by the bracketed values of the data to be inserted.
UPDATE is the command used to change data in the existing rows. To illustrate this, we shall write the command to change the input name of the user with ID 1034:
UPDATE Users
SET U_login=’master’
WHERE user_id=1034
Here, the name of the table in which changes are made follows the key word UPDATE. Then, the change as such is indicated after the key word SET. Finally, the predicate that follows the key word WHERE specifies the entry for which the change in question is made.
The delete command has rather a simple syntax. One example is:
DELETE FROM Users
WHERE user_id=1002
This case displays how the entry with the data of the user with ID 1002 is deleted from the USERS table.
325