← Back to MySQL Course | Chapter 1: Introduction & Basics | Lesson 2 of 8

MySQL SQL

SQL किसी relational database से बात करने के लिए standard language है, और इसके statements categories में आते हैं -- DDL, DML, और DCL -- इस आधार पर कि वे structure define करते हैं, data manipulate करते हैं, या permissions control करते हैं।

SQL क्या है?

SQL, या Structured Query Language, किसी relational database से communicate करने के लिए standard language है -- आपके बनाए हर table, आपके insert किए हर row, और आपके retrieve किए हर result को database server को भेजे गए एक SQL statement की तरह express किया जाता है।

उदाहरण: What is SQL?

sql
SELECT * FROM employees WHERE department = 'Sales';

SQL Statement Categories

SQL statements उनके काम के आधार पर categories में group किए जाते हैं: statements जो database का structure define करते हैं, statements जो इसके अंदर का data manipulate करते हैं, और statements जो control करते हैं कि कौन क्या कर सकता है।

उदाहरण: SQL Statement Categories

sql
CREATE TABLE employees (id INT);  -- defines structure
INSERT INTO employees VALUES (1); -- manipulates data
GRANT SELECT ON employees TO 'reader'@'localhost'; -- controls access

Data Definition Language (DDL)

Data Definition Language, या DDL, में CREATE, ALTER, और DROP जैसे statements शामिल हैं जो databases, tables, और दूसरे objects का structure define या बदलते हैं, उनके अंदर stored actual data को छूने के बजाय।

उदाहरण: Data Definition Language (DDL)

sql
CREATE TABLE products (id INT, name VARCHAR(50));
ALTER TABLE products ADD price DECIMAL(10,2);
DROP TABLE products;

Data Manipulation Language (DML)

Data Manipulation Language, या DML, में SELECT, INSERT, UPDATE, और DELETE जैसे statements शामिल हैं जो किसी table में stored data की actual rows पढ़ते और modify करते हैं, बिना table की underlying structure बदले।

उदाहरण: Data Manipulation Language (DML)

sql
CREATE TABLE customers (id INT, name VARCHAR(50));
INSERT INTO customers VALUES (1, 'Amit');
UPDATE customers SET name = 'Amit Kumar' WHERE id = 1;
DELETE FROM customers WHERE id = 1;
SELECT * FROM customers;

Data Control Language (DCL)

Data Control Language, या DCL, में GRANT और REVOKE जैसे statements शामिल हैं जो permissions manage करते हैं, control करते हुए कि कौन से database users specific databases और tables पढ़ने, modify करने, या administer करने के लिए allowed हैं।

उदाहरण: Data Control Language (DCL)

sql
GRANT SELECT, INSERT ON mydb.* TO 'app_user'@'localhost';
REVOKE INSERT ON mydb.* FROM 'app_user'@'localhost';
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. command line client में किसी statement के अंत में semicolon भूल जाना, ताकि यह ज़्यादा input का wait करे और hang जैसा दिखे।
  2. WHERE clause के बिना UPDATE या DELETE चलाना, जो table की हर row बदल या हटा देता है।
  3. यह मान लेना कि SQL keywords case sensitive हैं, जबकि select और SELECT same हैं हालाँकि table names Linux पर case sensitive हो सकते हैं।
🔒

Chapter Quiz — Complete all 8 topics to unlock

0/8 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.