SQL Queries Introduction in Hindi

SQL Queries Introduction in Hindi

Introduction

हेलो दोस्तों आज हम इस post में SQL की queries के बारेमे details से जानेगे!. इसके पहले example से समझते है आखिर SQL queries को कैसे case में इस्तेमाल किया जाता है!. मान लीजिये एक e-commerce website है!.

तो इन e-commerce website में जो data यानि product display होती है वह इन website के database से manage होती है और database क्या है? tables का collection है!, तो database में products को manage करने के लिए products का table हो सकता है!. साथ में website के users के data को manage करने के लिए users का table होगा!. साथ में e-commerce site से किस user ने कोनसा products को purchase किया तो इस orders को manage करने के लिए orders का table होगा!. और ये सभी tables man लीजिये एक e-commerce name के database में create हुवे है!. तो database के table में data को insert करने के लिए INSERT query का इस्तेमाल कर सकते है और website में products को display करने के लिए SELECT query का इस्तेमाल किया जाता है!. साथ में table के data को update करने के लिए UPDATE query और table से data को delete करने के लिए DELETE query का इस्तेमाल किया जाता है!.

तो इन सभी queries की basic समज हम इस post में लेंगे!.

SQL basic queries in hindi

SQL को समझने से पहले मान लीजिये हमारी pass products_details name का एक table है और इस table की field name है!.
product_id, product_name, product_description, product_type, product_category, product_image, product_price, product_compare_price
SQL queries को run करने से पहले एक case लेते है!. जिसमे हमें सभी product को website में display करना है!

  • SELECT statement
  • INSERT statement
  • UPDATE stetement
  • DELETE stetement

SELECT statement

First case: सभी products को website में display करना

Database से data को fetch करने के लिए SELECT query का इस्तेमाल किया जाता है!.

syntax

SELECT * FROM table_name

example

SELECT * FROM products_details

SELECT statement table की field चुनता है जिन्हे आप database से display करना चाहते है!. SELECT * का  मलतब table की सभी field की information fetch करते है!. और

SELECT product_id, product_name, product_image, product_price FROM products_details

query specific इन field की information ही database से fetch करते है!.

SELECT query में FROM keyword उसे table को point करता है जिस table से आप data को fetch करना चाहते हो!.

Second case: वही products को display करना है जो product category mans or womans के लिए हो!.

syntax:

SELECT * FROM table_name WHERE column_name = value

example

SELECT * FROM products_details WHERE product_category = 'woman'

WHERE keyword आपको table से specific information को fetch काने के लिए है!. जैसे की हमें only woman के products database से  fetch करना है!. तो जिस products की category woman होगी वह product database से fetch करनी है!.

SELECT * FROM products_details WHERE product_category ='woman'

और अगर only mans के लिए products  को display करना है तो

SELECT * FROM products_details WHERE product_category ='man'

Third case: custom दो prices low price और high price के bitch की products fetch करना

BETWEEN operator selects value दी गई range के अंदर की value को select करता है query में. इसमें value के तोर पर numbers, text और dates हो सकती है!.
BETWEEN operator minimum और maximum value को include करता है!.

SELECT * FROM products_details WHERE product_price BETWEEN 150 AND 250

Forth case: Woman category के products के साथ में product type के products fetch करने

SELECT * FROM products_details WHERE product_category='woman' AND product_type='simple'

AND operator अपने WHERE stement में additional criteria add करने की अनुमति देता है!. जैसे के WHERE statement में हमारी दो condition add की है एक to product_category=’woman’ और दूसरी product_type=’simple’ WHERE में AND statement के साथ जीतनी condition दी गई है वह सभी statement true होगी तब ही result प्राप्त कर पाएंगे. और OR statement
में सभी condition statement से एक condition statement true होती है तब बी database से data प्राप्त कर सकते है!.

INSERT statement

INSERT statement का इस्तेमाल database में data को insert करने के लिए INSERT query का इस्तेमाल किया जाता है!.INSERT INTO statement database में NEW record को INSERT करने के लिए है!. अगर products_details table में एक और new products को add करना चाहते है तो पहले हमें table का name provide करके कर सकते है और table में data table के field अनुसार data table में row और column के formate add कर सकते है!.

syntax:

INSERT INTO table_name (column1, column2, column3, ...)VALUES (value1, value2, value3, ...);

example:

INSERT INTO products_details (product_name, product_description, product_type, product_category, product_image, product_price, product_compare_price)
VALUES ('Black T-shirt', 'best product', 'simple', 'woman', 'image_name.jpg', '1500','1300');

UPDATE stetement

UPDATE stetement का इस्तेमाल database में मौजूद data को update यानि chanage करने के लिए UPDATE query का इस्तेमाल होता है!.

syntax:

UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition;

example:

UPDATE products_details SET product_price =150 WHERE product_id = 1

UPDATE query का इस्तेमाल करते time पे सावधान रहे यदि हमें यह specifies नहीं करते है की WHERE statement के साथ कोन से record को update करना है तो table के सभी data change हो सकते है!.

DELETE stetement

DELETE statement का इस्तेमाल table से record को remove करने के लिए किया जाता है!. UPDATE statement की तरह WHERE statement को add करना जरुरी है. ताकि हम गलती से अपनी पूरी table को delete न करदे!

syntax:

DELETE FROM table_name WHERE condition;

example:

DELETE FROM products_details WHERE products_id = 1

 

 

1 thought on “SQL Queries Introduction in Hindi<span class="post-views-after-title"><span class="post-views-after-title"><div class="post-views content-post post- entry-meta"><span class="post-views-icon dashicons dashicons-visibility"></span><span class="post-views-label">Post Views : </span><span class="post-views-count">2072</span></div></span></span>”

  1. Pingback: SQL command in hindi

Leave a Comment

Your email address will not be published. Required fields are marked *