Bulk insert from CSV-like staging
SQL
Hard
2 views
Problem Description
You loaded ProductsStage. Insert only valid rows (price>0 and name not null) into Products.
Output Format
DML statement(s)
Sample Test Case
Input:
ProductsStage(name, price), Products
Output:
Valid rows inserted
Constraints
Assume Products exists
Official Solution
INSERT INTO Products(name, price) SELECT name, price FROM ProductsStage WHERE name IS NOT NULL AND price > 0;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!