Insert date data to table : Insert « Insert Delete Update « PostgreSQL






Insert date data to table


postgres=#
postgres=# CREATE TABLE weather (
postgres(#    city            varchar(80),
postgres(#    temp_lo         int,           -- low temperature
postgres(#    temp_hi         int,           -- high temperature
postgres(#    prcp            real,          -- precipitation
postgres(#    date            date
postgres(# );
CREATE TABLE
postgres=#
postgres=#
postgres=# INSERT INTO weather (city, temp_lo, temp_hi, prcp, date)
postgres-#    VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29');
INSERT 0 1
postgres=#
postgres=# INSERT INTO weather (date, city, temp_hi, temp_lo)
postgres-#    VALUES ('1994-11-29', 'Hayward', 54, 37);
INSERT 0 1
postgres=#
postgres=#
postgres=# drop table weather;
DROP TABLE
postgres=#
           
       








Related examples in the same category

1.The data values are listed in the order in which the columns appear in the table, separated by commas
2.List the columns explicitly
3.Omit values
4.Fill the columns from the left with as many values as are given, and the rest will be defaulted
5.Request default values explicitly, for individual columns
6.Request default values explicitly for the entire row
7.Inserts a single row into the employees table
8.Insert only an ID: only one column