<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daily - TheCodeBuzz</title>
	<atom:link href="https://thecodebuzz.com/category/daily/feed/" rel="self" type="application/rss+xml" />
	<link>https://thecodebuzz.com</link>
	<description>Best Practices for Software Development</description>
	<lastBuildDate>Sat, 08 Feb 2025 17:42:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://thecodebuzz.com/wp-content/uploads/2022/11/cropped-android-chrome-512x512-1-1-51x51.jpg</url>
	<title>Daily - TheCodeBuzz</title>
	<link>https://thecodebuzz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Daily used commands for a Developer</title>
		<link>https://thecodebuzz.com/daily-used-commands-for-a-developer/</link>
					<comments>https://thecodebuzz.com/daily-used-commands-for-a-developer/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 08 Feb 2025 17:41:19 +0000</pubDate>
				<category><![CDATA[Daily]]></category>
		<guid isPermaLink="false">https://thecodebuzz.com/?p=30670</guid>

					<description><![CDATA[<p>Daily used commands for a Developer Summary of Top 10 SQL Commands Command Description SELECT Retrieve data from a table INSERT Add new records UPDATE Modify existing records DELETE Remove records CREATE TABLE Define a new table ALTER TABLE Modify table structure DROP TABLE Delete an entire table JOIN Combine data from multiple tables GROUP [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/daily-used-commands-for-a-developer/">Daily used commands for a Developer</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Daily used commands for a Developer</h1>



<p class=""><strong>Summary of Top 10 SQL Commands</strong></p>



<p class=""></p>



<figure class="wp-block-table"><table class="has-fixed-layout"><thead><tr><th>Command</th><th>Description</th></tr></thead></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>SELECT</strong></td><td>Retrieve data from a table</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>INSERT</strong></td><td>Add new records</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>UPDATE</strong></td><td>Modify existing records</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>DELETE</strong></td><td>Remove records</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>CREATE TABLE</strong></td><td>Define a new table</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>ALTER TABLE</strong></td><td>Modify table structure</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>DROP TABLE</strong></td><td>Delete an entire table</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>JOIN</strong></td><td>Combine data from multiple tables</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>GROUP BY &amp; HAVING</strong></td><td>Aggregate and filter data</td></tr></tbody></table></figure>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>ORDER BY</strong></td><td>Sort query results</td></tr></tbody></table></figure>



<p class=""></p>



<p class=""></p>



<h3 class="wp-block-heading"><strong>SELECT – Retrieve Data from a Table</strong></h3>



<pre class="wp-block-preformatted"><code>SELECT * FROM Employees;<br>SELECT Name, Age FROM Employees WHERE Age > 30;<br></code></pre>



<p class="">✅ <strong>Fetches data</strong> from a database table.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>2️⃣ INSERT – Add New Records</strong></h3>



<pre class="wp-block-preformatted"><code>INSERT INTO Employees (Name, Age, City) <br>VALUES ('John Doe', 28, 'New York');<br></code></pre>



<p class="">✅ <strong>Inserts new data</strong> into a table.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>3️⃣ UPDATE – Modify Existing Records</strong></h3>



<pre class="wp-block-preformatted"><code>UPDATE Employees <br>SET Age = 29 <br>WHERE Name = 'John Doe';<br></code></pre>



<p class="">✅ <strong>Updates existing data</strong> in a table.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>4️⃣ DELETE – Remove Records</strong></h3>



<pre class="wp-block-preformatted"><code>DELETE FROM Employees WHERE Age &lt; 25;<br></code></pre>



<p class="">✅ <strong>Removes specific records</strong> from a table.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>5️⃣ CREATE TABLE – Define a New Table</strong></h3>



<pre class="wp-block-preformatted"><code>CREATE TABLE Employees (<br>    ID INT PRIMARY KEY AUTO_INCREMENT,<br>    Name VARCHAR(100),<br>    Age INT,<br>    City VARCHAR(50)<br>);<br></code></pre>



<p class="">✅ <strong>Creates a new table</strong> in the database.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>6️⃣ ALTER TABLE – Modify an Existing Table</strong></h3>



<pre class="wp-block-preformatted"><code>ALTER TABLE Employees ADD COLUMN Salary DECIMAL(10,2);<br></code></pre>



<p class="">✅ <strong>Adds, removes, or modifies columns</strong> in an existing table.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>7️⃣ DROP TABLE – Delete an Entire Table</strong></h3>



<pre class="wp-block-preformatted"><code>DROP TABLE Employees;<br></code></pre>



<p class="">✅ <strong>Completely removes a table</strong> from the database.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>8️⃣ JOIN – Combine Data from Multiple Tables</strong></h3>



<pre class="wp-block-preformatted"><code>SELECT Employees.Name, Departments.DepartmentName <br>FROM Employees <br>INNER JOIN Departments ON Employees.DepartmentID = Departments.ID;<br></code></pre>



<p class="">✅ <strong>Retrieves data</strong> from multiple related tables.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>9️⃣ GROUP BY &amp; HAVING – Aggregate Data</strong></h3>



<pre class="wp-block-preformatted"><code>SELECT City, COUNT(*) AS EmployeeCount <br>FROM Employees <br>GROUP BY City <br>HAVING COUNT(*) > 5;<br></code></pre>



<p class="">✅ <strong>Groups records</strong> and <strong>filters aggregates</strong>.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>🔟 ORDER BY – Sort Query Results</strong></h3>



<pre class="wp-block-preformatted">S<code>ELECT * FROM Employees ORDER BY Age DESC;<br></code></pre>



<p class="">✅ <strong>Sorts data</strong> in ascending or descending order.</p>



<p class=""></p>



<p class=""></p>



<p class=""></p>



<h3 class="wp-block-heading"><strong>1️⃣ Show All Databases</strong></h3>



<pre class="wp-block-preformatted"><code>show dbs<br></code></pre>



<p class="">✅ <strong>Lists all databases</strong> in the MongoDB server.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>2️⃣ Use a Specific Database</strong></h3>



<pre class="wp-block-preformatted"><code>use myDatabase<br></code></pre>



<p class="">✅ <strong>Switches to a specific database</strong> (creates it if it doesn’t exist).</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>3️⃣ Show All Collections</strong></h3>



<pre class="wp-block-preformatted"><code>show collections<br></code></pre>



<p class="">✅ <strong>Lists all collections (tables)</strong> inside the current database.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>4️⃣ Insert a Document</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.insertOne({ name: "John Doe", age: 30, city: "New York" })<br></code></pre>



<p class="">✅ <strong>Adds a new record</strong> into the <code>employees</code> collection.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>5️⃣ Find (Retrieve) Documents</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.find()<br>db.employees.find({ age: { $gt: 25 } })<br></code></pre>



<p class="">✅ <strong>Fetches all documents</strong> or filters by conditions.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>6️⃣ Update a Document</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.updateOne({ name: "John Doe" }, { $set: { age: 31 } })<br></code></pre>



<p class="">✅ <strong>Modifies specific fields</strong> in a document.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>7️⃣ Delete a Document</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.deleteOne({ name: "John Doe" })<br></code></pre>



<p class="">✅ <strong>Removes a single document</strong> from the collection.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>8️⃣ Create an Index (Improve Query Performance)</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.createIndex({ name: 1 })<br></code></pre>



<p class="">✅ <strong>Adds an index</strong> to speed up queries.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>9️⃣ Aggregate (Group &amp; Process Data)</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.aggregate([<br>    { $group: { _id: "$city", total: { $sum: 1 } } }<br>])<br></code></pre>



<p class="">✅ <strong>Groups documents</strong> and performs operations like <code>sum</code>, <code>count</code>, etc.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>🔟 Drop a Collection (Delete a Table)</strong></h3>



<pre class="wp-block-preformatted"><code>db.employees.drop()<br></code></pre>



<p class="">✅ <strong>Removes the entire collection</strong> from the database.</p>



<p class=""></p>



<p class=""></p>



<h3 class="wp-block-heading"><strong>1️⃣ Find Documents Greater Than a Specific Date (<code>$gt</code>)</strong></h3>



<p class="">👉 <strong>Get orders placed after <code>2024-02-05</code></strong></p>



<pre class="wp-block-preformatted"><code>db.orders.find({ orderDate: { $gt: ISODate("2024-02-05T00:00:00Z") } })<br></code></pre>



<p class="">✅ <strong>Returns orders after <code>2024-02-05</code></strong></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>2️⃣ Find Documents Less Than a Specific Date (<code>$lt</code>)</strong></h3>



<p class="">👉 <strong>Get orders placed before <code>2024-02-05</code></strong></p>



<pre class="wp-block-preformatted"><code>db.orders.find({ orderDate: { $lt: ISODate("2024-02-05T00:00:00Z") } })<br></code></pre>



<p class="">✅ <strong>Returns orders before <code>2024-02-05</code></strong></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>3️⃣ Find Documents Between Two Dates (<code>$gte</code> and <code>$lte</code>)</strong></h3>



<p class="">👉 <strong>Get orders placed between <code>2024-02-01</code> and <code>2024-02-10</code></strong></p>



<pre class="wp-block-preformatted"><code>db.orders.find({ <br>    orderDate: { <br>        $gte: ISODate("2024-02-01T00:00:00Z"), <br>        $lte: ISODate("2024-02-10T23:59:59Z") <br>    } <br>})<br></code></pre>



<p class="">✅ <strong>Returns orders within the specified date range</strong></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>4️⃣ Find Documents on an Exact Date (<code>$eq</code>)</strong></h3>



<p class="">👉 <strong>Get orders placed exactly on <code>2024-02-05</code></strong></p>



<pre class="wp-block-preformatted"><code>db.orders.find({ orderDate: { $eq: ISODate("2024-02-05T00:00:00Z") } })<br></code></pre>



<p class="">✅ <strong>Returns orders with the exact date</strong></p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading"><strong>5️⃣ Find Orders Within the Last 7 Days (<code>$gte</code> and <code>new Date()</code>)</strong></h3>



<pre class="wp-block-preformatted"><code>db.orders.find({ <br>    orderDate: { <br>        $gte: new Date(new Date().setDate(new Date().getDate() - 7))<br>    } <br>})</code></pre>



<p class=""></p>



<p class=""></p>



<p class=""></p><p>The post <a href="https://thecodebuzz.com/daily-used-commands-for-a-developer/">Daily used commands for a Developer</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/daily-used-commands-for-a-developer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
