Now as we have create the table lets insert some data into it, thats whats tables are for - storing data.
There are several methods by which data can be inserted into the table:
1. By Values
2. By Select (from another table)
Insertion by Value:
INSERT INTO <table_name> (
<column_name_1>,
<column_name_2>, …
<column_name_N> )
VALUES (
<column_value_1>,
<column_value_2>,…
<column_value_N> );
Commit;
Here:
<table_name> : is the table name where data needs to be inserted
<column_name> : is the column names in the table
<column_value>: is the corresponding column value that needs to be inserted
Insertion by Select:
INSERT INTO <table_name> (
<column_name_1>,
<column_name_2>, …
<column_name_N> )
SELECT <column_value_1>,
<column_value_2>,…
<column_value_N>
FROM <from_table_name> ...;
Commit;
Here:
<table_name> : is the table name where data needs to be inserted
<column_name> : is the column names in the table
<column_value>: is the corresponding column value that needs to be inserted
<from_table_name>: is the table from where the date needs to be selected
We will discuss the select statement in detail soon in the coming notes.
No comments:
Post a Comment