INSERT and SELECT How to Use in Single Query

SQL query you can use for both INSERT into values and SELECT.

This query saves your time when you do testing in development regions or working in data warehousing projects.


Join 1,888 other followers


The Query INSERT and SELECT

The simple syntax is

INSERT INTO table_name
(column_values1,
column_values2)
values(name1,name2);
SELECT * FROM table_name;

To learn the above query is more than enough . The real advantage of this SQL query is you can insert values as many as you want and you can see the data you inserted.

Real SQL query

CREATE TABLE SRNI_TABLE
(NAME CHAR (10),ROLE CHAR(10));
INSERT INTO SRNI_TABLE
(NAME,ROLE) VALUES('SRINI','ENGINEER');
SELECT *
FROM SRNI_TABLE;

Result

NAME,     ROLE 
===== ====
SRINIMF SOFTWARE
SRINIMF SOFTWARE
SRINIMF SOFTWARE
SRINI ENGINEER

The benefits of INSERT and SELECT

  • You can avoid mistakes
  • Saves time again to re-check the values

References

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.

One thought

Comments are closed.