Checkpoint 21.5.1.
Q-1: What is the SQL command that is used to add new data to a table?
CREATE TABLE Tracks (title TEXT, plays INTEGER)
INSERT command:INSERT INTO Tracks (title, plays) VALUES ('My Way', 15)
INSERT statement specifies the table name, then a list of the fields/columns that you would like to set in the new row, and then the keyword VALUES and a list of corresponding values for each of the fields.SELECT command is used to retrieve rows and columns from a database. The SELECT statement lets you specify which columns you would like to retrieve as well as a WHERE clause to select which rows you would like to see. It also allows an optional ORDER BY clause to control the sorting of the returned rows.SELECT * FROM Tracks WHERE title = 'My Way'
* indicates that you want the database to return all of the columns for each row that matches the WHERE clause.WHERE clause we use a single equal sign to indicate a test for equality rather than a double equal sign.WHERE
<, >, <=, >=, !=, as well as AND and OR and parentheses to build your logical expressions.SELECT title,plays FROM Tracks ORDER BY title
WHERE clause on an SQL DELETE statement. The WHERE clause determines which rows are to be deleted:DELETE FROM Tracks WHERE title = 'My Way'
UPDATE a column or columns within one or more rows in a table using the SQL UPDATE statement as follows:UPDATE Tracks SET plays = 16 WHERE title = 'My Way'
UPDATE statement specifies a table and then a list of fields and values to change after the SET keyword and then an optional WHERE clause to select the rows that are to be updated. A single UPDATE statement will change all of the rows that match the WHERE clause. If a WHERE clause is not specified, it performs the UPDATE on all of the rows in the table.