INSERT and SELECT in single SQL query top example for interviews

SQL query you can use for both INSERT into values and SELECT. This kind of query being used in testing regions while you are working on Data Warehousing projects or any development projects.

Join 1,772 other followers

The Query INSERT and SELECT

The simple syntax is


INSERT INTO table_name(column_values1,coulumn_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.