🚂 RailGuruji
Databases and Structured Query Language (SQL)डेटाबेस और स्ट्रक्चर्ड क्वेरी लैंग्वेज (SQL)4 / 8

Structured Query Language (SQL): the commands the papers askस्ट्रक्चर्ड क्वेरी लैंग्वेज (SQL): वे कमांड जो प्रश्नपत्र पूछते हैं

Practise this page · 14 Qइस पेज का अभ्यास · 14 प्रश्न
Updated अद्यतन 02 Nov 2026
This pageयह पेज asked in 2 exams2 परीक्षाओं में पूछा गयाThis chapterयह अध्याय asked in 2 exams2 परीक्षाओं में पूछा गया
1
asked in 2 exams2 परीक्षाओं में पूछा गयाAEDPM (L-08) IT Department — RCF/Kapurthala, 2026 · AEDPM (L-08) IT Department — RCF/Kapurthala, 2022
QUERYING WITH SELECTसेलेक्ट से क्वेरी
SQL, STRUCTURED QUERY LANGUAGE, is how you talk to a relational database. It queries, updates and changes its structure and security.
  • SELECT retrieves data: SELECT * FROM table
  • WHERE filters the rows, with = > < and != or <>
  • ORDER BY arranges the rows in ascending or descending order
  • GROUP functions: COUNT, SUM, MAX, MIN, AVG; COUNT() returns the number of records
  • LIKE matches text: % for any characters, _ for one character
So SELECT retrieves, WHERE filters, and ORDER BY sorts.
एसक्यूएल, अर्थात् स्ट्रक्चर्ड क्वेरी लैंग्वेज, से आप रिलेशनल डेटाबेस से बात करते हैं। यह क्वेरी करती है, अद्यतन करती है, और संरचना तथा सुरक्षा बदलती है।
  • सेलेक्ट डेटा निकालता है: SELECT * FROM table
  • व्हेयर पंक्तियाँ छाँटता है, = > < और != या <> से
  • ऑर्डर बाय पंक्तियों को आरोही या अवरोही क्रम में रखता है
  • ग्रुप फंक्शन: काउंट, सम, मैक्स, मिन, एवीजी; काउंट() रिकॉर्डों की संख्या देता है
  • लाइक पाठ मिलाता है: किसी भी अक्षरों के लिए %, एक अक्षर के लिए _
अर्थात् सेलेक्ट निकालता है, व्हेयर छाँटता है, और ऑर्डर बाय क्रम में रखता है।
2
asked in 1 exam1 परीक्षा में पूछा गयाAEDPM (L-08) IT Department — RCF/Kapurthala, 2026
VIEWS AND SET OPERATORSव्यू और सेट ऑपरेटर
  • A VIEW is a VIRTUAL TABLE built from one or more tables. It holds no data of its own
  • SET OPERATORS combine two query results: UNION, INTERSECT, MINUS
  • SPECIAL OPERATORS test a sub-query: EXISTS, SOME, ANY, ALL
  • CONSTRAINTS reject invalid rows: PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK, NOT NULL, DEFAULT
Codd's sixth rule is about updating views. So a view looks like a table, but it is built from others when you query it.
  • व्यू एक या अधिक तालिकाओं से बनी वर्चुअल तालिका है। इसका अपना कोई डेटा नहीं होता
  • सेट ऑपरेटर दो क्वेरी परिणाम जोड़ते हैं: यूनियन, इंटरसेक्ट, माइनस
  • विशेष ऑपरेटर उप-क्वेरी जाँचते हैं: एग्जिस्ट्स, सम, एनी, ऑल
  • कंस्ट्रेंट अमान्य पंक्तियाँ अस्वीकार करते हैं: प्राइमरी की, फॉरेन की, यूनिक, चेक, नॉट नल, डिफॉल्ट
कॉड का छठा नियम व्यू के अद्यतन के बारे में है। अर्थात् व्यू तालिका जैसा दिखता है, पर क्वेरी करने पर दूसरी तालिकाओं से बनता है।
3
asked in 1 exam1 परीक्षा में पूछा गयाAEDPM (L-08) IT Department — RCF/Kapurthala, 2022
SQL FUNCTIONSएसक्यूएल फंक्शन
NUMBERS AND TEXTसंख्या और पाठ
Oracle gives you ready-made functions. The papers ask what a few of them return, so learn each with its example.
  • ABS returns the absolute value: ABS(-25) = 25
  • CEIL returns the smallest integer greater than or equal to its argument; FLOOR returns the largest integer equal to or less than it
  • MOD returns the remainder when the first number is divided by the second
  • || joins two strings, and the CONCAT function does the same
  • LPAD and RPAD both take the string, the length to pad it to, and an optional pad character: LPAD('Tech',7,'*') gives ***Tech, RPAD gives Tech***
Watch the minus sign with FLOOR. The largest integer below -7.8 is -8, not -7. So FLOOR rounds down, CEIL rounds up, and MOD keeps the remainder.
ओरेकल आपको तैयार फंक्शन देता है। प्रश्नपत्र इनमें से कुछ का परिणाम पूछते हैं, इसलिए हर एक को उसके उदाहरण के साथ सीखिए।
  • एब्स निरपेक्ष मान देता है: ABS(-25) = 25
  • सील अपने तर्क के बराबर या उससे बड़ा सबसे छोटा पूर्णांक देता है; फ्लोर उसके बराबर या उससे छोटा सबसे बड़ा पूर्णांक देता है
  • मॉड पहली संख्या को दूसरी से भाग देने पर शेषफल देता है
  • || दो स्ट्रिंग जोड़ता है, और कॉनकैट फंक्शन भी यही करता है
  • एलपैड और आरपैड दोनों स्ट्रिंग, भरने के बाद की लंबाई और एक वैकल्पिक भराव अक्षर लेते हैं: LPAD('Tech',7,'*') से ***Tech मिलता है, RPAD से Tech***
फ्लोर में ऋण चिह्न पर ध्यान दीजिए। -7.8 से नीचे का सबसे बड़ा पूर्णांक -8 है, -7 नहीं। अर्थात् फ्लोर नीचे की ओर, सील ऊपर की ओर पूर्णांक बनाता है, और मॉड शेषफल रखता है।
4
CONSTRAINTS AND CASCADESकंस्ट्रेंट और कैस्केड
A constraint is a rule a column must obey. The database refuses any row that breaks it.
  • NOT NULL: the column must always hold a value
  • UNIQUE: no two rows may share a value in the column
  • PRIMARY KEY: unique and not null at once, and a table has only one
  • FOREIGN KEY: points to the primary key of another table, and blocks changes that would break that link
  • DEFAULT gives a column its value when you supply none; CHECK limits the values a column may hold
  • ON DELETE CASCADE: deleting a parent row deletes the child rows that point to it
  • ON UPDATE CASCADE carries an update from the parent to those child rows in the same way
So a constraint guards each row, and a cascade keeps parent and child in step.
कंस्ट्रेंट वह नियम है जो किसी कॉलम को मानना पड़ता है। डेटाबेस उसे तोड़ने वाली कोई भी पंक्ति स्वीकार नहीं करता।
  • नॉट नल: कॉलम में हमेशा कोई मान होना चाहिए
  • यूनीक: कॉलम में कोई दो पंक्तियाँ एक ही मान नहीं रख सकतीं
  • प्राइमरी की: एक साथ यूनीक और नॉट नल, और एक टेबल में केवल एक
  • फॉरेन की: दूसरी टेबल की प्राइमरी की की ओर संकेत करती है, और वह कड़ी तोड़ने वाले बदलाव रोकती है
  • डिफॉल्ट मान न देने पर कॉलम को उसका मान देता है; चेक उन मानों को सीमित करता है जो कॉलम रख सकता है
  • ऑन डिलीट कैस्केड: पैरेंट पंक्ति हटाने पर उसकी ओर संकेत करने वाली चाइल्ड पंक्तियाँ भी हट जाती हैं
  • ऑन अपडेट कैस्केड इसी तरह पैरेंट का अपडेट उन चाइल्ड पंक्तियों तक ले जाता है
अर्थात् कंस्ट्रेंट हर पंक्ति की रक्षा करता है, और कैस्केड पैरेंट और चाइल्ड को साथ रखता है।
5
DELETE, TRUNCATE OR DROPडिलीट, ट्रंकेट या ड्रॉप
Three commands remove data, and you must know which one leaves what behind.
  • DELETE removes the rows a WHERE condition picks and leaves the table; it is DML
  • TRUNCATE removes every row but keeps the empty table; it is DDL
  • DROP removes the table itself, with its data and its structure; it is DDL too
So TRUNCATE keeps the empty table, and DROP leaves nothing behind.
तीन कमांड डेटा हटाती हैं, और आपको जानना है कि कौन-सी कमांड पीछे क्या छोड़ती है।
  • डिलीट व्हेयर शर्त से चुनी गई पंक्तियाँ हटाता है और टेबल छोड़ देता है; यह डीएमएल है
  • ट्रंकेट हर पंक्ति हटाता है पर खाली टेबल रखता है; यह डीडीएल है
  • ड्रॉप टेबल को ही, उसके डेटा और संरचना समेत, हटा देता है; यह भी डीडीएल है
अर्थात् ट्रंकेट खाली टेबल रखता है, और ड्रॉप कुछ भी नहीं छोड़ता।
Report an error on this pageइस पेज में गलती बताएँ

Finished this page? Practise it now.यह पेज पूरा हुआ? अब इसका अभ्यास कीजिए।Finished this page? Practise its chapter.यह पेज पूरा हुआ? अब इसके अध्याय का अभ्यास कीजिए।

Only questions asked in real past papersकेवल पिछले वर्षों के प्रश्नपत्रों में पूछे गए प्रश्नOnly practice questions, none from a past paperकेवल अभ्यास प्रश्न, कोई भी पिछले प्रश्नपत्र से नहींPast-paper and practice questions togetherपिछले प्रश्नपत्रों के और अभ्यास प्रश्न, दोनों

or take the free Mock CBTया फ्री Mock CBT दें