PostgreSQL Insert Record: Insert one row into a table against the specific column country_name
2. Write a SQL statement to insert one row into the table countries against the column country_id and country_name.
Here in the following is the structure of the table countries.
Column | Type | Modifiers --------------+-----------------------+----------- country_id | character varying(2) | country_name | character varying(40) | region_id | numeric(10,0) |
Sample Solution:
Code:
INSERT INTO countries (country_id,country_name) VALUES('C2','USA');
Here is the command to see the list of the inserting rows :
postgres=# SELECT * FROM countries; country_id | country_name | region_id ------------+--------------+----------- C1 | India | 1002 C2 | USA |
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a SQL statement to insert a record with your own value into the table countries against each column.
Next: Write a SQL statement to create duplicates of countries table named country_new with all structure and data.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework