SQL Hinglish Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

SQL Hinglish Guide: Beginner to Advanced

---

Introduction to SQL

SQL (Structured Query Language) ek database management ke liye use hone wali language hai. Iska use

---

Basic Concepts

1. Database: Ek organized collection of data.

2. Table: Rows aur columns ka ek set jisme data store hota hai.

3. Query: SQL statement jo data manipulate karne ke liye likha jata hai.

---

Common SQL Commands

1. SELECT: Data ko retrieve karne ke liye.

SELECT column1, column2 FROM table_name;

2. INSERT: Naya data insert karne ke liye.

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


3. UPDATE: Existing data ko modify karne ke liye.

UPDATE table_name SET column1 = 'value' WHERE condition;

4. DELETE: Data ko delete karne ke liye.

DELETE FROM table_name WHERE condition;

5. CREATE TABLE: Nayi table banane ke liye.

CREATE TABLE table_name (

column1 datatype,

column2 datatype

);

6. DROP TABLE: Puri table ko delete karne ke liye.

DROP TABLE table_name;

---

Intermediate Concepts

1. WHERE Clause:

SELECT * FROM table_name WHERE condition;

Example:

SELECT * FROM Employees WHERE Age > 30;

2. Joins:

- Inner Join:

SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column;


- Left Join:

SELECT * FROM table1 LEFT JOIN table2 ON table1.column = table2.column;

- Right Join:

SELECT * FROM table1 RIGHT JOIN table2 ON table1.column = table2.column;

3. GROUP BY and HAVING:

SELECT column1, COUNT(*) FROM table_name GROUP BY column1 HAVING COUNT(*) > 1;

4. ORDER BY:

SELECT * FROM table_name ORDER BY column1 ASC/DESC;

---

Advanced Concepts

1. Subqueries:

SELECT column1 FROM table_name WHERE column2 = (SELECT column2 FROM another_table WHE

2. Indexes:

CREATE INDEX index_name ON table_name (column_name);

3. Views:

CREATE VIEW view_name AS SELECT column1, column2 FROM table_name WHERE condition;

4. Stored Procedures:

CREATE PROCEDURE procedure_name AS BEGIN SQL_statements END;


5. Triggers:

CREATE TRIGGER trigger_name BEFORE/AFTER INSERT/UPDATE/DELETE ON table_name FOR EA

---

Interview Questions with Answers

Q1. SQL kya hai aur iske main uses kya hain?

Ans: SQL ek language hai jo database management ke liye use hoti hai. Iska main use data ko retrieve, mo

Q2. Primary Key aur Foreign Key mein kya difference hai?

Ans:

- Primary Key: Table ke har row ko uniquely identify karti hai.

- Foreign Key: Ek table ke relationship ko doosri table ke saath define karti hai.

Q3. SQL ke different types of joins ka example do.

- Inner Join:

SELECT * FROM Employees INNER JOIN Departments ON Employees.DeptID = Departments.ID;

- Left Join:

SELECT * FROM Employees LEFT JOIN Departments ON Employees.DeptID = Departments.ID;

Q4. NULL aur NOT NULL ka kya use hai?

- NULL: Data absent hone ka indicator hai.

- NOT NULL: Column me data hona mandatory hai.

Q5. Indexes ka kya role hai SQL me?

Ans: Indexes query performance improve karte hain by making data retrieval faster.
---

Practice Questions

1. Ek table "Students" create kijiye with columns (ID, Name, Age, Marks).

2. "Students" table me 5 rows insert kijiye.

3. Un students ka naam fetch kijiye jinke marks 80 se zyada hain.

4. "Students" table se un rows ko delete kijiye jinke marks 50 se kam hain.

---

Note: Practice karte samay syntax errors ka dhyan rakhiye aur SQL queries ko test karte rahiye. Agar koi d

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy