SQL Statements

সর্বশেষ আপডেট:

Insert Statement:

INSERT INTO table_name (column1, column2) VALUES ('value1', 'value2');

-- Insert Multiple Row
INSERT INTO table_name (column1, column2) VALUES ('row1_val1', 'row1_val2'), ('row2_val1', 'row2_val2');

Select Statement:

-- All Data
SELECT * FROM table_name;

-- Specific Column
SELECT column1, column2 FROM table_name;

-- Limit Rows
-- Get first five rows
SELECT * FROM table_name LIMIT 5;

-- Condition: Exact Match
SELECT * FROM table_name WHERE column1='value1';

-- Condition: Substring
SELECT * FROM table_name WHERE column1 LIKE '%value%';

Update Statement:

-- Update a row where id column data is 5
Update table_name SET column1='val1', column2='val2' WHERE id=5;

-- Update all rows with same value
-- WHERE clause is omitted
Update table_name SET column1='val1';

Delete Statement:

-- Delete a row where id column data is 5
DELETE FROM table_name WHERE id=5;

-- Delete all records
-- WHERE clause is omitted
DELETE FROM table_name;
শেয়ার, কমেন্ট, মেইল বা প্রিন্ট করুন

মন্তব্য করুন

আপনার ই-মেইল এ্যাড্রেস প্রকাশিত হবে না।