Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 653 Bytes

inserting-data-into-tables.md

File metadata and controls

27 lines (20 loc) · 653 Bytes

How to insert data into tables.

Lets say we have a simple table within our db for students. This would be created as follows:

CREATE TABLE student(
    id INT PRIMARY KEY,
    name VARCHAR(20),
    email VARCHAR(30) DEFAULT 'no email',
    major VARCHAR(20)
);

Now the table has been created we need to insert data into it. We do that as follows:

INSERT INTO student VALUES(1, 'Paul Bennett', '[email protected]', 'SQL Databases');

Let me break down what's in the value ()

We insert the data in the order of the columns.