SQL LESSON 26 OF 32

INSERT & parameterized values

INSERT adds rows. Name columns explicitly. In application code, bind user inputs as parameters instead of concatenating them into SQL. Here we practise with fixed sample literals; never paste real personal data.

हिन्दी में समझें

INSERT पंक्ति जोड़ता है। कॉलम के नाम दें। ऐप में उपयोगकर्ता मान पैरामीटर से जोड़ें, SQL टेक्स्ट में सीधे न मिलाएँ। यहाँ केवल नकली नमूने हैं।

अभ्यास: ग्राहक id 7, name Isha, city Kochi जोड़ें और नई पंक्ति दिखाएँ।

Hinglish mein samjhein

INSERT rows add karta hai. Columns explicitly name karo. App code mein user input parameters se bind karo, SQL concatenate mat karo. Yahan sirf sample literals use karo.

Practice: Customer 7,Isha,Kochi add karo aur nayi row dikhao.

A small SQL example

INSERT INTO customers(id,name,city) VALUES(7,'Dev','Goa');
SELECT * FROM customers WHERE id=7;

Examples use the fictional shop database bundled with the SQL playground: customers, products, orders, order_items and employees. The engine is SQLite; other SQL dialects may differ.

Try this example in the SQL playground →

Practise this idea

Add customer id 7, name Isha, city Kochi. Show that new row.

Check answer & explanation
INSERT INTO customers(id,name,city) VALUES(7,'Isha','Kochi'); SELECT * FROM customers WHERE id=7;

Naming INSERT columns makes the supplied values unambiguous. The new id is unused in the sample database, and the SELECT checks that row.

Stuck in the course? Choose Check answer for either the challenge or quiz. Read the explanation and continue to the next lesson at your own pace.

Check your understanding

Bind user inputs with…

  1. Parameters
  2. String concatenation
  3. HTML tags
Check the quiz answer

Parameters

INSERT adds rows. Name columns explicitly. In application code, bind user inputs as parameters instead of concatenating them into SQL. Here we practise with fixed sample literals; never paste real personal data.

References & corrections

Use the official SQLite documentation for full language rules. Read how these lessons are made and checked. Found a mistake? Report it to Excel Keys with this lesson URL and a reproducible example.

FROM LEARNING TO BUSINESS RESULTS

Need a dashboard for your team?

Excel Keys designs custom Excel and HTML dashboards around your own KPIs and Excel files. They run offline in the browser, so your data stays on your computer.