INSERT Statement

 the presenter covers the INSERT statement in SQL, which is used to add new rows to a table in a relational database. Here's a summary of the key points:

  1. Purpose of INSERT statement: The INSERT statement is part of Data Manipulation Language (DML) in SQL, used to read and modify data in a database. It is specifically used to add new rows of data to a table.


  2. Syntax of INSERT statement: The syntax of the INSERT statement is as follows: INSERT INTO table_name (column1, column2, ..., columnN) VALUES (value1, value2, ..., valueN);

      • table_name: Name of the table where data is to be inserted.
      • (column1, column2, ..., columnN): List of columns into which data will be inserted.
      • (value1, value2, ..., valueN): Corresponding values to be inserted into each column listed.
    1. Inserting one row at a time: Data can be inserted into a table one row at a time by providing values for each column in the VALUES clause.

    2. Inserting multiple rows at once: Multiple rows can be inserted into a table in a single INSERT statement by specifying each row's values separated by commas in the VALUES clause.

    Example: INSERT INTO author (author_id, last_name, first_name, email, city, country) VALUES ('A1', 'Chong', 'Raul', 'RFC@IBM.com', 'Toronto', 'CA'), ('A2', 'Ahuja', 'Rav', 'Rav@xyz.com', 'Delhi', 'IN'); By understanding the syntax and usage of the INSERT statement, users can effectively add new data to tables within a relational database.

Comments

Popular posts from this blog

Lila's Journey to Becoming a Data Scientist: Her Working Approach on the First Task

Notes on Hiring for Data Science Teams

switch functions