{"id":3180,"date":"2025-06-06T13:20:13","date_gmt":"2025-06-06T13:20:13","guid":{"rendered":"https:\/\/diznr.com\/?p=3180"},"modified":"2025-06-06T13:20:13","modified_gmt":"2025-06-06T13:20:13","slug":"gate-cseit-database-relational-algebra-part-1-selection-and-operator-projection","status":"publish","type":"post","link":"https:\/\/www.reilsolar.com\/pdf\/gate-cseit-database-relational-algebra-part-1-selection-and-operator-projection\/","title":{"rendered":"GATE CSEIT\/Database Relational algebra part 1 ( Selection and projection operator)."},"content":{"rendered":"<p>GATE CSEIT\/Database Relational algebra part 1 ( Selection and projection operator).<\/p>\n<p>[fvplayer id=&#8221;288&#8243;]<\/p>\n<p data-start=\"0\" data-end=\"258\">Relational algebra is a foundational aspect of database query languages, providing a formal framework for manipulating and retrieving data from relational databases. Two fundamental unary operations in relational algebra are <strong data-start=\"225\" data-end=\"238\">selection<\/strong> and <strong data-start=\"243\" data-end=\"257\">projection<\/strong>.<\/p>\n<p data-start=\"260\" data-end=\"287\"><strong data-start=\"260\" data-end=\"287\">Selection Operator (\u03c3):<\/strong><\/p>\n<p data-start=\"289\" data-end=\"560\">The selection operator filters rows (tuples) from a relation based on a specified predicate. It retrieves only those tuples that satisfy the given condition, effectively performing a horizontal partitioning of the relation. The general form of the selection operation is:<\/p>\n<p data-start=\"562\" data-end=\"596\"><span class=\"katex\"><span class=\"katex-mathml\">\u03c3condition(R)\\sigma_{\\text{condition}}(R)<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord\"><span class=\"mord mathnormal\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\"><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord text mtight\">condition<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">R<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/p>\n<p data-start=\"598\" data-end=\"788\">Here, <span class=\"katex\"><span class=\"katex-mathml\">RR<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord mathnormal\">R<\/span><\/span><\/span><\/span> represents the relation, and the condition is a predicate applied to each tuple. For example, to select employees with a salary greater than 50,000 from an &#8216;Employee&#8217; relation:<\/p>\n<p data-start=\"790\" data-end=\"843\"><span class=\"katex\"><span class=\"katex-mathml\">\u03c3salary&gt;50000(Employee)\\sigma_{\\text{salary} &gt; 50000}(\\text{Employee})<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord\"><span class=\"mord mathnormal\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\"><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord text mtight\">salary<\/span><span class=\"mrel mtight\">&gt;<\/span>50000<\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord text\"><span class=\"mord\">Employee<\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/p>\n<p data-start=\"845\" data-end=\"980\">This operation will yield a relation containing only those employees whose salary exceeds 50,000.<\/p>\n<p data-start=\"982\" data-end=\"1010\"><strong data-start=\"982\" data-end=\"1010\">Projection Operator (\u03c0):<\/strong><\/p>\n<p data-start=\"1012\" data-end=\"1281\">The projection operator extracts specific columns (attributes) from a relation, effectively performing a vertical partitioning. It removes duplicate rows in the result, ensuring that the output is a set of unique tuples. The general form of the projection operation is:<\/p>\n<p data-start=\"1283\" data-end=\"1361\"><span class=\"katex\"><span class=\"katex-mathml\">\u03c0attribute1,attribute2,\u2026,attributeN(R)\\pi_{\\text{attribute1}, \\text{attribute2}, \\ldots, \\text{attributeN}}(R)<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord\"><span class=\"mord mathnormal\">\u03c0<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\"><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord text mtight\">attribute1<\/span><span class=\"mpunct mtight\">,<\/span><span class=\"mord text mtight\">attribute2<\/span><span class=\"mpunct mtight\">,<\/span><span class=\"minner mtight\">\u2026<\/span><span class=\"mpunct mtight\">,<\/span><span class=\"mord text mtight\">attributeN<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\">R<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/p>\n<p data-start=\"1363\" data-end=\"1464\">For example, to retrieve only the names and departments of all employees from an &#8216;Employee&#8217; relation:<\/p>\n<p data-start=\"1466\" data-end=\"1525\"><span class=\"katex\"><span class=\"katex-mathml\">\u03c0name,department(Employee)\\pi_{\\text{name}, \\text{department}}(\\text{Employee})<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord\"><span class=\"mord mathnormal\">\u03c0<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\"><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord text mtight\">name<\/span><span class=\"mpunct mtight\">,<\/span><span class=\"mord text mtight\">department<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord text\"><span class=\"mord\">Employee<\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/p>\n<p data-start=\"1527\" data-end=\"1689\">This operation will produce a relation containing unique combinations of employee names and their corresponding departments.<\/p>\n<p data-start=\"1691\" data-end=\"1711\"><strong data-start=\"1691\" data-end=\"1711\">Key Differences:<\/strong><\/p>\n<ul data-start=\"1713\" data-end=\"1890\">\n<li data-start=\"1713\" data-end=\"1790\"><strong data-start=\"1715\" data-end=\"1733\">Selection (\u03c3):<\/strong> Operates on rows, filtering tuples based on a condition.<\/li>\n<li data-start=\"1791\" data-end=\"1890\"><strong data-start=\"1793\" data-end=\"1812\">Projection (\u03c0):<\/strong> Operates on columns, extracting specified attributes and removing duplicates.<\/li>\n<\/ul>\n<p data-start=\"1892\" data-end=\"1904\"><strong data-start=\"1892\" data-end=\"1904\">Example:<\/strong><\/p>\n<p data-start=\"1906\" data-end=\"1982\">Consider a &#8216;Student&#8217; relation with attributes (StudentID, Name, Age, Major):<\/p>\n<div class=\"overflow-x-auto contain-inline-size\">\n<table data-start=\"1984\" data-end=\"2241\">\n<thead data-start=\"1984\" data-end=\"2026\">\n<tr data-start=\"1984\" data-end=\"2026\">\n<th data-start=\"1984\" data-end=\"1996\">StudentID<\/th>\n<th data-start=\"1996\" data-end=\"2005\">Name<\/th>\n<th data-start=\"2005\" data-end=\"2011\">Age<\/th>\n<th data-start=\"2011\" data-end=\"2026\">Major<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2070\" data-end=\"2241\">\n<tr data-start=\"2070\" data-end=\"2112\">\n<td>1<\/td>\n<td>Alice<\/td>\n<td>20<\/td>\n<td>ComputerSci<\/td>\n<\/tr>\n<tr data-start=\"2113\" data-end=\"2155\">\n<td>2<\/td>\n<td>Bob<\/td>\n<td>22<\/td>\n<td>Math<\/td>\n<\/tr>\n<tr data-start=\"2156\" data-end=\"2198\">\n<td>3<\/td>\n<td>Charlie<\/td>\n<td>20<\/td>\n<td>Physics<\/td>\n<\/tr>\n<tr data-start=\"2199\" data-end=\"2241\">\n<td>4<\/td>\n<td>David<\/td>\n<td>23<\/td>\n<td>ComputerSci<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<ul data-start=\"2243\" data-end=\"2723\">\n<li data-start=\"2243\" data-end=\"2531\">\n<p data-start=\"2245\" data-end=\"2285\"><strong data-start=\"2245\" data-end=\"2259\">Selection:<\/strong> To find students aged 20:<\/p>\n<p data-start=\"2289\" data-end=\"2335\"><span class=\"katex\"><span class=\"katex-mathml\">\u03c3Age=20(Student)\\sigma_{\\text{Age} = 20}(\\text{Student})<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord\"><span class=\"mord mathnormal\">\u03c3<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\"><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord text mtight\">Age<\/span><span class=\"mrel mtight\">=<\/span>20<\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord text\"><span class=\"mord\">Student<\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/p>\n<p data-start=\"2339\" data-end=\"2346\">Result:<\/p>\n<div class=\"overflow-x-auto contain-inline-size\">\n<table data-start=\"2350\" data-end=\"2531\">\n<thead data-start=\"2350\" data-end=\"2393\">\n<tr data-start=\"2350\" data-end=\"2393\">\n<th data-start=\"2350\" data-end=\"2362\">StudentID<\/th>\n<th data-start=\"2362\" data-end=\"2372\">Name<\/th>\n<th data-start=\"2372\" data-end=\"2378\">Age<\/th>\n<th data-start=\"2378\" data-end=\"2393\">Major<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2442\" data-end=\"2531\">\n<tr data-start=\"2442\" data-end=\"2485\">\n<td>1<\/td>\n<td>Alice<\/td>\n<td>20<\/td>\n<td>ComputerSci<\/td>\n<\/tr>\n<tr data-start=\"2488\" data-end=\"2531\">\n<td>3<\/td>\n<td>Charlie<\/td>\n<td>20<\/td>\n<td>Physics<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/li>\n<li data-start=\"2533\" data-end=\"2723\">\n<p data-start=\"2535\" data-end=\"2577\"><strong data-start=\"2535\" data-end=\"2550\">Projection:<\/strong> To list all unique majors:<\/p>\n<p data-start=\"2581\" data-end=\"2621\"><span class=\"katex\"><span class=\"katex-mathml\">\u03c0Major(Student)\\pi_{\\text{Major}}(\\text{Student})<\/span><span class=\"katex-html\" aria-hidden=\"true\"><span class=\"base\"><span class=\"mord\"><span class=\"mord mathnormal\">\u03c0<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\"><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord text mtight\">Major<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><\/span><\/span><\/span><span class=\"mopen\">(<\/span><span class=\"mord text\"><span class=\"mord\">Student<\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/p>\n<p data-start=\"2625\" data-end=\"2632\">Result:<\/p>\n<div class=\"overflow-x-auto contain-inline-size\">\n<table data-start=\"2636\" data-end=\"2723\">\n<thead data-start=\"2636\" data-end=\"2651\">\n<tr data-start=\"2636\" data-end=\"2651\">\n<th data-start=\"2636\" data-end=\"2651\">Major<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2672\" data-end=\"2723\">\n<tr data-start=\"2672\" data-end=\"2687\">\n<td>ComputerSci<\/td>\n<\/tr>\n<tr data-start=\"2690\" data-end=\"2705\">\n<td>Math<\/td>\n<\/tr>\n<tr data-start=\"2708\" data-end=\"2723\">\n<td>Physics<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/li>\n<\/ul>\n<p data-start=\"2725\" data-end=\"2979\">Understanding these operators is crucial for formulating queries in relational databases and is a significant component of database management systems, especially in the context of GATE Computer Science examinations.<\/p>\n<p data-start=\"2981\" data-end=\"3132\">For a visual explanation and further examples of selection and projection operations in relational algebra, you might find the following video helpful:<\/p>\n<div class=\"not-prose mb-3 flex flex-col gap-4 text-base\">\n<div><\/div>\n<h3><a href=\"https:\/\/cs186berkeley.net\/fa20\/resources\/static\/notes\/n05-RelAlg.pdf\" target=\"_blank\" rel=\"noopener\">GATE CSEIT\/Database Relational algebra part 1 ( Selection and projection operator).<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"http:\/\/www.gcekjr.ac.in\/pdf\/lectures\/2023\/6719Module%202%20(Relational%20Algebra)_5th%20Semester_Computer%20Science%20And%20Engineering.pdf\" target=\"_blank\" rel=\"noopener\">Module 2 Relational Algebra 25-08-2025 Prepared by<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.cs.ucdavis.edu\/~green\/courses\/ecs165a-w11\/3-ra.pdf\" target=\"_blank\" rel=\"noopener\">3. Relational Model and Relational Algebra<\/a><\/h3>\n<p data-start=\"0\" data-end=\"208\">Here\u2019s a <strong data-start=\"9\" data-end=\"48\">simple and GATE-focused explanation<\/strong> of <strong data-start=\"52\" data-end=\"83\">Relational Algebra \u2013 Part 1<\/strong> covering the <strong data-start=\"97\" data-end=\"114\">Selection (\u03c3)<\/strong> and <strong data-start=\"119\" data-end=\"147\">Projection (\u03c0) operators<\/strong> \u2014 essential for <strong data-start=\"164\" data-end=\"195\">GATE CSE\/IT Database (DBMS)<\/strong> preparation.<\/p>\n<hr data-start=\"210\" data-end=\"213\" \/>\n<h2 data-start=\"215\" data-end=\"276\">\ud83d\udcd8 <strong data-start=\"221\" data-end=\"276\">Relational Algebra \u2013 Part 1: Selection &amp; Projection<\/strong><\/h2>\n<p data-start=\"278\" data-end=\"419\">Relational Algebra is a <strong data-start=\"302\" data-end=\"331\">procedural query language<\/strong> in DBMS used to retrieve data from relational databases using <strong data-start=\"394\" data-end=\"418\">set-based operations<\/strong>.<\/p>\n<hr data-start=\"421\" data-end=\"424\" \/>\n<h3 data-start=\"426\" data-end=\"462\">\ud83d\udd39 <strong data-start=\"433\" data-end=\"462\">1. Selection Operator (\u03c3)<\/strong><\/h3>\n<h4 data-start=\"464\" data-end=\"483\">\ud83e\uddfe <strong data-start=\"472\" data-end=\"483\">Syntax:<\/strong><\/h4>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">php-template<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"language-xml\">\u03c3<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">condition<\/span><\/span><\/span>&gt;(Relation)<br \/>\n<\/code><\/div>\n<\/div>\n<h4 data-start=\"516\" data-end=\"536\">\ud83d\udca1 <strong data-start=\"524\" data-end=\"536\">Meaning:<\/strong><\/h4>\n<p data-start=\"537\" data-end=\"627\">It <strong data-start=\"540\" data-end=\"565\">selects rows (tuples)<\/strong> from the table (relation) that <strong data-start=\"597\" data-end=\"626\">satisfy a given condition<\/strong>.<\/p>\n<h4 data-start=\"629\" data-end=\"645\">\ud83d\udccc Example:<\/h4>\n<p data-start=\"646\" data-end=\"682\">Let\u2019s say the relation <code data-start=\"669\" data-end=\"678\">Student<\/code> is:<\/p>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"684\" data-end=\"808\">\n<thead data-start=\"684\" data-end=\"708\">\n<tr data-start=\"684\" data-end=\"708\">\n<th data-start=\"684\" data-end=\"691\" data-col-size=\"sm\">Roll<\/th>\n<th data-start=\"691\" data-end=\"699\" data-col-size=\"sm\">Name<\/th>\n<th data-start=\"699\" data-end=\"708\" data-col-size=\"sm\">Marks<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"734\" data-end=\"808\">\n<tr data-start=\"734\" data-end=\"758\">\n<td data-start=\"734\" data-end=\"741\" data-col-size=\"sm\">1<\/td>\n<td data-start=\"741\" data-end=\"749\" data-col-size=\"sm\">Aman<\/td>\n<td data-start=\"749\" data-end=\"758\" data-col-size=\"sm\">85<\/td>\n<\/tr>\n<tr data-start=\"759\" data-end=\"783\">\n<td data-start=\"759\" data-end=\"766\" data-col-size=\"sm\">2<\/td>\n<td data-start=\"766\" data-end=\"774\" data-col-size=\"sm\">Riya<\/td>\n<td data-start=\"774\" data-end=\"783\" data-col-size=\"sm\">75<\/td>\n<\/tr>\n<tr data-start=\"784\" data-end=\"808\">\n<td data-start=\"784\" data-end=\"791\" data-col-size=\"sm\">3<\/td>\n<td data-start=\"791\" data-end=\"799\" data-col-size=\"sm\">John<\/td>\n<td data-start=\"799\" data-end=\"808\" data-col-size=\"sm\">90<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"810\" data-end=\"816\">Query:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">scss<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">\u03c3 <span class=\"hljs-attribute\">Marks<\/span> &gt; <span class=\"hljs-number\">80<\/span> (Student)<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"849\" data-end=\"858\">\u2705 Output:<\/p>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"860\" data-end=\"959\">\n<thead data-start=\"860\" data-end=\"884\">\n<tr data-start=\"860\" data-end=\"884\">\n<th data-start=\"860\" data-end=\"867\" data-col-size=\"sm\">Roll<\/th>\n<th data-start=\"867\" data-end=\"875\" data-col-size=\"sm\">Name<\/th>\n<th data-start=\"875\" data-end=\"884\" data-col-size=\"sm\">Marks<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"910\" data-end=\"959\">\n<tr data-start=\"910\" data-end=\"934\">\n<td data-start=\"910\" data-end=\"917\" data-col-size=\"sm\">1<\/td>\n<td data-start=\"917\" data-end=\"925\" data-col-size=\"sm\">Aman<\/td>\n<td data-start=\"925\" data-end=\"934\" data-col-size=\"sm\">85<\/td>\n<\/tr>\n<tr data-start=\"935\" data-end=\"959\">\n<td data-start=\"935\" data-end=\"942\" data-col-size=\"sm\">3<\/td>\n<td data-start=\"942\" data-end=\"950\" data-col-size=\"sm\">John<\/td>\n<td data-start=\"950\" data-end=\"959\" data-col-size=\"sm\">90<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"961\" data-end=\"1013\">\ud83c\udfaf <strong data-start=\"964\" data-end=\"1013\">It filters rows based on the given condition.<\/strong><\/p>\n<hr data-start=\"1015\" data-end=\"1018\" \/>\n<h3 data-start=\"1020\" data-end=\"1057\">\ud83d\udd39 <strong data-start=\"1027\" data-end=\"1057\">2. Projection Operator (\u03c0)<\/strong><\/h3>\n<h4 data-start=\"1059\" data-end=\"1078\">\ud83e\uddfe <strong data-start=\"1067\" data-end=\"1078\">Syntax:<\/strong><\/h4>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">php-template<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"language-xml\">\u03c0<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">attribute<\/span><\/span><\/span> <span class=\"hljs-attr\">list<\/span>&gt;(Relation)<br \/>\n<\/code><\/div>\n<\/div>\n<h4 data-start=\"1116\" data-end=\"1136\">\ud83d\udca1 <strong data-start=\"1124\" data-end=\"1136\">Meaning:<\/strong><\/h4>\n<p data-start=\"1137\" data-end=\"1188\">It <strong data-start=\"1140\" data-end=\"1172\">selects columns (attributes)<\/strong> from the table.<\/p>\n<h4 data-start=\"1190\" data-end=\"1206\">\ud83d\udccc Example:<\/h4>\n<p data-start=\"1207\" data-end=\"1241\">Using the same <code data-start=\"1222\" data-end=\"1231\">Student<\/code> relation.<\/p>\n<p data-start=\"1243\" data-end=\"1249\">Query:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">scss<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">\u03c0 Name, <span class=\"hljs-attribute\">Marks<\/span> (Student)<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"1283\" data-end=\"1292\">\u2705 Output:<\/p>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"1294\" data-end=\"1383\">\n<thead data-start=\"1294\" data-end=\"1311\">\n<tr data-start=\"1294\" data-end=\"1311\">\n<th data-start=\"1294\" data-end=\"1302\" data-col-size=\"sm\">Name<\/th>\n<th data-start=\"1302\" data-end=\"1311\" data-col-size=\"sm\">Marks<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1330\" data-end=\"1383\">\n<tr data-start=\"1330\" data-end=\"1347\">\n<td data-start=\"1330\" data-end=\"1338\" data-col-size=\"sm\">Aman<\/td>\n<td data-start=\"1338\" data-end=\"1347\" data-col-size=\"sm\">85<\/td>\n<\/tr>\n<tr data-start=\"1348\" data-end=\"1365\">\n<td data-start=\"1348\" data-end=\"1356\" data-col-size=\"sm\">Riya<\/td>\n<td data-start=\"1356\" data-end=\"1365\" data-col-size=\"sm\">75<\/td>\n<\/tr>\n<tr data-start=\"1366\" data-end=\"1383\">\n<td data-start=\"1366\" data-end=\"1374\" data-col-size=\"sm\">John<\/td>\n<td data-start=\"1374\" data-end=\"1383\" data-col-size=\"sm\">90<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p data-start=\"1385\" data-end=\"1446\">\ud83c\udfaf <strong data-start=\"1388\" data-end=\"1446\">It removes unwanted columns and may remove duplicates.<\/strong><\/p>\n<hr data-start=\"1448\" data-end=\"1451\" \/>\n<h3 data-start=\"1453\" data-end=\"1480\">\ud83e\udde0 <strong data-start=\"1460\" data-end=\"1480\">Key Differences:<\/strong><\/h3>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"1482\" data-end=\"2039\">\n<thead data-start=\"1482\" data-end=\"1574\">\n<tr data-start=\"1482\" data-end=\"1574\">\n<th data-start=\"1482\" data-end=\"1498\" data-col-size=\"sm\">Feature<\/th>\n<th data-start=\"1498\" data-end=\"1535\" data-col-size=\"sm\">Selection (\u03c3)<\/th>\n<th data-start=\"1535\" data-end=\"1574\" data-col-size=\"sm\">Projection (\u03c0)<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"1668\" data-end=\"2039\">\n<tr data-start=\"1668\" data-end=\"1760\">\n<td data-start=\"1668\" data-end=\"1684\" data-col-size=\"sm\">Works on<\/td>\n<td data-start=\"1684\" data-end=\"1721\" data-col-size=\"sm\">Rows (tuples)<\/td>\n<td data-start=\"1721\" data-end=\"1760\" data-col-size=\"sm\">Columns (attributes)<\/td>\n<\/tr>\n<tr data-start=\"1761\" data-end=\"1853\">\n<td data-start=\"1761\" data-end=\"1777\" data-col-size=\"sm\">Purpose<\/td>\n<td data-start=\"1777\" data-end=\"1814\" data-col-size=\"sm\">Filter data using conditions<\/td>\n<td data-col-size=\"sm\" data-start=\"1814\" data-end=\"1853\">Select specific columns<\/td>\n<\/tr>\n<tr data-start=\"1854\" data-end=\"1946\">\n<td data-start=\"1854\" data-end=\"1870\" data-col-size=\"sm\">Removes<\/td>\n<td data-start=\"1870\" data-end=\"1907\" data-col-size=\"sm\">Rows that don&#8217;t satisfy condition<\/td>\n<td data-start=\"1907\" data-end=\"1946\" data-col-size=\"sm\">Columns not listed<\/td>\n<\/tr>\n<tr data-start=\"1947\" data-end=\"2039\">\n<td data-start=\"1947\" data-end=\"1963\" data-col-size=\"sm\">Duplicate rows<\/td>\n<td data-col-size=\"sm\" data-start=\"1963\" data-end=\"2000\">Not affected<\/td>\n<td data-col-size=\"sm\" data-start=\"2000\" data-end=\"2039\">May remove duplicates<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"2041\" data-end=\"2044\" \/>\n<h3 data-start=\"2046\" data-end=\"2074\">\ud83e\uddea <strong data-start=\"2053\" data-end=\"2074\">Combined Example:<\/strong><\/h3>\n<p data-start=\"2076\" data-end=\"2082\">Query:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">css<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">\u03c0 Name (\u03c3 <span class=\"hljs-attribute\">Marks<\/span> &gt; <span class=\"hljs-number\">80<\/span> (Student))<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"2124\" data-end=\"2139\">\u2705 Step-by-step:<\/p>\n<ul data-start=\"2141\" data-end=\"2278\">\n<li data-start=\"2141\" data-end=\"2211\">\n<p data-start=\"2143\" data-end=\"2211\">First apply: <code data-start=\"2156\" data-end=\"2180\">\u03c3 Marks &gt; 80 (Student)<\/code><br data-start=\"2180\" data-end=\"2183\" \/>\u2192 Gives rows with Marks &gt; 80<\/p>\n<\/li>\n<li data-start=\"2213\" data-end=\"2278\">\n<p data-start=\"2215\" data-end=\"2278\">Then apply: <code data-start=\"2227\" data-end=\"2235\">\u03c0 Name<\/code><br data-start=\"2235\" data-end=\"2238\" \/>\u2192 Gives only <code data-start=\"2251\" data-end=\"2257\">Name<\/code> column of those rows<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"2280\" data-end=\"2293\">Final Output:<\/p>\n<div class=\"_tableContainer_16hzy_1\">\n<div class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n<table class=\"w-fit min-w-(--thread-content-width)\" data-start=\"2295\" data-end=\"2334\">\n<thead data-start=\"2295\" data-end=\"2304\">\n<tr data-start=\"2295\" data-end=\"2304\">\n<th data-start=\"2295\" data-end=\"2304\" data-col-size=\"sm\">Name<\/th>\n<\/tr>\n<\/thead>\n<tbody data-start=\"2315\" data-end=\"2334\">\n<tr data-start=\"2315\" data-end=\"2324\">\n<td data-start=\"2315\" data-end=\"2324\" data-col-size=\"sm\">Aman<\/td>\n<\/tr>\n<tr data-start=\"2325\" data-end=\"2334\">\n<td data-start=\"2325\" data-end=\"2334\" data-col-size=\"sm\">John<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\n<div class=\"absolute end-0 flex items-end\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<hr data-start=\"2336\" data-end=\"2339\" \/>\n<h2 data-start=\"2341\" data-end=\"2375\">\ud83d\udcdd GATE-Level Practice Question<\/h2>\n<p data-start=\"2377\" data-end=\"2483\"><strong data-start=\"2377\" data-end=\"2383\">Q:<\/strong> Consider relation <code data-start=\"2402\" data-end=\"2437\">Employee(EID, Name, Salary, Dept)<\/code>.<br data-start=\"2438\" data-end=\"2441\" \/>What does the following expression return?<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">pgsql<\/div>\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-sidebar-surface-primary text-token-text-secondary dark:bg-token-main-surface-secondary flex items-center rounded-sm px-2 font-sans text-xs\"><button class=\"flex gap-1 items-center select-none px-4 py-1\" aria-label=\"Copy\">Copy<\/button><span class=\"\" data-state=\"closed\"><button class=\"flex items-center gap-1 px-4 py-1 select-none\">Edit<\/button><\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">\u03c0 <span class=\"hljs-type\">Name<\/span> (\u03c3 Dept = <span class=\"hljs-string\">'HR'<\/span> \u2227 Salary &gt; <span class=\"hljs-number\">30000<\/span> (Employee))<br \/>\n<\/code><\/div>\n<\/div>\n<p data-start=\"2545\" data-end=\"2710\"><strong data-start=\"2545\" data-end=\"2551\">A)<\/strong> Names of all employees<br data-start=\"2574\" data-end=\"2577\" \/><strong data-start=\"2577\" data-end=\"2583\">B)<\/strong> Names of HR employees with salary &gt; 30000 \u2705<br data-start=\"2627\" data-end=\"2630\" \/><strong data-start=\"2630\" data-end=\"2636\">C)<\/strong> Employees with salary &lt; 30000<br data-start=\"2666\" data-end=\"2669\" \/><strong data-start=\"2669\" data-end=\"2675\">D)<\/strong> Names and salaries of HR employees<\/p>\n<hr data-start=\"2712\" data-end=\"2715\" \/>\n<h2 data-start=\"2717\" data-end=\"2742\">\ud83d\udcda Extra Tip for GATE:<\/h2>\n<ul data-start=\"2744\" data-end=\"2934\">\n<li data-start=\"2744\" data-end=\"2818\">\n<p data-start=\"2746\" data-end=\"2818\">These operations are <strong data-start=\"2767\" data-end=\"2786\">building blocks<\/strong> for complex relational queries.<\/p>\n<\/li>\n<li data-start=\"2819\" data-end=\"2873\">\n<p data-start=\"2821\" data-end=\"2873\">Practice query simplification and output prediction.<\/p>\n<\/li>\n<li data-start=\"2874\" data-end=\"2934\">\n<p data-start=\"2876\" data-end=\"2934\">Often asked in <strong data-start=\"2891\" data-end=\"2901\">1-mark<\/strong> or <strong data-start=\"2905\" data-end=\"2920\">2-mark MCQs<\/strong> with outputs.<\/p>\n<\/li>\n<\/ul>\n<hr data-start=\"2936\" data-end=\"2939\" \/>\n<h2 data-start=\"2941\" data-end=\"2957\">\ud83c\udf93 Want More?<\/h2>\n<p data-start=\"2959\" data-end=\"2974\">Would you like:<\/p>\n<ul data-start=\"2976\" data-end=\"3085\">\n<li data-start=\"2976\" data-end=\"3011\">\n<p data-start=\"2978\" data-end=\"3011\">\ud83d\uddbc\ufe0f Diagrams for these operators?<\/p>\n<\/li>\n<li data-start=\"3012\" data-end=\"3039\">\n<p data-start=\"3014\" data-end=\"3039\">\ud83d\udcdd PDF notes or quiz set?<\/p>\n<\/li>\n<li data-start=\"3040\" data-end=\"3085\">\n<p data-start=\"3042\" data-end=\"3085\">\ud83c\udfa5 Short video (Hindi\/English) explanation?<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"3087\" data-end=\"3125\" data-is-last-node=\"\" data-is-only-node=\"\">Let me know and I\u2019ll send it your way!<\/p>\n<h3 data-start=\"3087\" data-end=\"3125\"><a href=\"https:\/\/gwcet.ac.in\/uploaded_files\/UNIT-2_DBMS_5TH_SEM.pdf\" target=\"_blank\" rel=\"noopener\">GATE CSEIT\/Database Relational algebra part 1 ( Selection and projection operator).<\/a><\/h3>\n<h3 class=\"LC20lb MBeuO DKV0Md\"><a href=\"https:\/\/www.cs.colostate.edu\/~cs430dl\/pages\/more_examples\/Ch2\/Relational%20algebra%20-%20projection.pdf\" target=\"_blank\" rel=\"noopener\">Relational algebra operators &#8211; projection<\/a><\/h3>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>GATE CSEIT\/Database Relational algebra part 1 ( Selection and projection operator). [fvplayer id=&#8221;288&#8243;] Relational algebra is a foundational aspect of database query languages, providing a formal framework for manipulating and retrieving data from relational databases. Two fundamental unary operations in relational algebra are selection and projection. Selection Operator (\u03c3): The selection operator filters rows (tuples) [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[],"class_list":["post-3180","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/3180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/comments?post=3180"}],"version-history":[{"count":0,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/posts\/3180\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/media?parent=3180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/categories?post=3180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.reilsolar.com\/pdf\/wp-json\/wp\/v2\/tags?post=3180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}