Tsallaka zuwa abun ciki
Justice Tech School

INSERT ... SELECT

Copy rows between tables by inserting the result of a query.

Example
CREATE TABLE honour (name TEXT, score INTEGER);
INSERT INTO honour SELECT name, score FROM students WHERE score >= 85;
SELECT * FROM honour;

Result

name   | score
Ada    | 92
Amina  | 85
Zainab | 88

Exercise

Copy from a query.

INSERT INTO a  * FROM b

Quiz Test

INSERT SELECT copies?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.