<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mercy Musyoka</title>
    <description>The latest articles on DEV Community by Mercy Musyoka (@impactbymercy).</description>
    <link>https://dev.to/impactbymercy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3394001%2Fa21f3efe-a141-4acb-9e2e-7b20375a2fa2.jpg</url>
      <title>DEV Community: Mercy Musyoka</title>
      <link>https://dev.to/impactbymercy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/impactbymercy"/>
    <language>en</language>
    <item>
      <title>🚀 SQL Stored Procedures vs. Python Functions: Two Worlds, Same Idea</title>
      <dc:creator>Mercy Musyoka</dc:creator>
      <pubDate>Mon, 08 Sep 2025 12:42:32 +0000</pubDate>
      <link>https://dev.to/impactbymercy/sql-stored-procedures-vs-python-functions-two-worlds-same-idea-ob0</link>
      <guid>https://dev.to/impactbymercy/sql-stored-procedures-vs-python-functions-two-worlds-same-idea-ob0</guid>
      <description>&lt;p&gt;When I first started learning &lt;strong&gt;SQL&lt;/strong&gt; and &lt;strong&gt;Python&lt;/strong&gt;, I thought they had nothing in common. One was all about databases and the other about programming.&lt;/p&gt;

&lt;p&gt;But the more I used them, the more I realized: stored procedures in SQL and functions in Python are like cousins living in different houses.&lt;/p&gt;

&lt;p&gt;Here’s why 👇&lt;br&gt;
&lt;strong&gt;What They Are&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stored Procedure (SQL)&lt;/strong&gt;: A set of SQL statements stored inside the database, ready to be reused.&lt;br&gt;
&lt;strong&gt;Python Function&lt;/strong&gt;: A block of Python code you can call whenever you need it.&lt;br&gt;
Both are about &lt;strong&gt;reusability&lt;/strong&gt; and &lt;strong&gt;encapsulation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Similarities&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1. Encapsulation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both let you wrap logic into a single unit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Reusability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Write once, use many times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Parameters &amp;amp; Inputs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both can accept inputs to handle different situations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Return Values&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both give something back — a dataset in SQL, or any object in Python.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Control Flow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both support conditions, loops, and error handling.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Examples in Action&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here’s how they compare in real life:&lt;/p&gt;

&lt;h4&gt;
  
  
  SQL Stored Procedure:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE PROCEDURE GetEmployee (@id INT)
AS
BEGIN
    SELECT name, salary 
    FROM employees
    WHERE emp_id = @id;
END;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Python Function:
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_employee(emp_id):
    employees = {1: ("Alice", 5000), 2: ("Bob", 6000)}
    return employees.get(emp_id, ("Not Found", 0
))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Take an ID as input&lt;/li&gt;
&lt;li&gt;Run some logic&lt;/li&gt;
&lt;li&gt;Return employee details&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Stored Procedure&lt;/th&gt;
&lt;th&gt;Python Function&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Encapsulation&lt;/td&gt;
&lt;td&gt;SQL statements&lt;/td&gt;
&lt;td&gt;Python code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reusability&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Parameters&lt;/td&gt;
&lt;td&gt;Input/Output&lt;/td&gt;
&lt;td&gt;Arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Return Values&lt;/td&gt;
&lt;td&gt;Results/Output&lt;/td&gt;
&lt;td&gt;&lt;code&gt;return&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Control Flow&lt;/td&gt;
&lt;td&gt;IF, WHILE, CASE&lt;/td&gt;
&lt;td&gt;if, for, try&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Where They Shine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use stored procedures when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Heavy data processing happens in the database&lt;/li&gt;
&lt;li&gt;You want to reduce network trips&lt;/li&gt;
&lt;li&gt;Security &amp;amp; consistency are top priorities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Python functions when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logic belongs in the application layer&lt;/li&gt;
&lt;li&gt;You need flexibility and integration with libraries&lt;/li&gt;
&lt;li&gt;Data has already been fetched into your program&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Final Thoughts
&lt;/h4&gt;

&lt;p&gt;Even though they live in different environments, stored procedures and Python functions share the same DNA: encapsulating, reusing, and organizing logic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you combine them, you get the best of both worlds:&lt;/li&gt;
&lt;li&gt;Databases handle data-heavy tasks&lt;/li&gt;
&lt;li&gt;Applications handle business logic&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>sql</category>
      <category>python</category>
      <category>datascience</category>
      <category>devcommunity</category>
    </item>
    <item>
      <title>Subqueries vs. CTEs vs. Stored Procedures in SQL — Explained Simply 🚀</title>
      <dc:creator>Mercy Musyoka</dc:creator>
      <pubDate>Mon, 08 Sep 2025 12:07:01 +0000</pubDate>
      <link>https://dev.to/impactbymercy/subqueries-vs-ctes-vs-stored-procedures-in-sql-explained-simply-1phe</link>
      <guid>https://dev.to/impactbymercy/subqueries-vs-ctes-vs-stored-procedures-in-sql-explained-simply-1phe</guid>
      <description>&lt;p&gt;&lt;strong&gt;SQL&lt;/strong&gt; offers different tools to query and manage data effectively. Three common concepts that often confuse beginners are subqueries, CTEs (Common Table Expressions), and stored procedures. While they may look similar at first, they serve different purposes and have unique strengths.&lt;/p&gt;

&lt;h2&gt;
  
  
  In this article, we’ll break them down one by one with examples, then summarize their key differences.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Subquery (Nested Query)
&lt;/h3&gt;

&lt;p&gt;A subquery is a query written inside another query. It’s commonly used to provide intermediate results for filtering, aggregation, or transformation.&lt;/p&gt;

&lt;p&gt;Key Features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Exists only while the main query runs.&lt;/li&gt;
&lt;li&gt;Can be written inside &lt;code&gt;WHERE&lt;/code&gt;,&lt;code&gt;FROM&lt;/code&gt;, or &lt;code&gt;SELECT&lt;/code&gt; clauses.&lt;/li&gt;
&lt;li&gt;Great for filtering based on calculated values.
Example
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT name, salary
FROM employees
WHERE salary &amp;gt; (SELECT AVG(salary) FROM employees);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the subquery&lt;code&gt;(SELECT AVG(salary) …)&lt;/code&gt; calculates the average salary, and the outer query selects employees who earn above it.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. CTE (Common Table Expression)
&lt;/h3&gt;

&lt;p&gt;A CTE is a temporary, named result set created with the WITH keyword. Think of it as giving a subquery a name so you can reuse it and make your query more readable.&lt;/p&gt;

&lt;p&gt;Key Features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Exists only during a single query execution.&lt;/li&gt;
&lt;li&gt;Improves readability and avoids deeply nested queries.&lt;/li&gt;
&lt;li&gt;Can be referenced multiple times in the same query.&lt;/li&gt;
&lt;li&gt;Supports recursion (useful for hierarchical data like org charts).
Example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WITH HighEarners AS (
    SELECT name, salary
    FROM employees
    WHERE salary &amp;gt; 5000
)
SELECT * FROM HighEarners;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;HighEarners&lt;/code&gt; acts like a temporary table that can be reused in the query.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Stored Procedure
&lt;/h3&gt;

&lt;p&gt;A stored procedure is a saved, compiled block of SQL code stored permanently in the database. Unlike subqueries and CTEs, it isn’t tied to a single query but can be executed anytime.&lt;/p&gt;

&lt;p&gt;Key Features:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stored permanently in the database.&lt;/li&gt;
&lt;li&gt;Can accept parameters (input/output).&lt;/li&gt;
&lt;li&gt;Can include complex logic: loops, conditions, error handling.&lt;/li&gt;
&lt;li&gt;Useful for reusability, automation, and encapsulating business logic.
Example:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE PROCEDURE GetHighEarners (@minSalary INT)
AS
BEGIN
    SELECT name, salary
    FROM employees
    WHERE salary &amp;gt; @minSalary;
END;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it with:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;EXEC GetHighEarners @minSalary = 6000;&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Quick Comparison
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Subquery&lt;/th&gt;
&lt;th&gt;CTE&lt;/th&gt;
&lt;th&gt;Stored Procedure&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scope&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Inside a single query&lt;/td&gt;
&lt;td&gt;Within one query&lt;/td&gt;
&lt;td&gt;Permanent in DB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Reusability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not reusable&lt;/td&gt;
&lt;td&gt;Reusable within the query&lt;/td&gt;
&lt;td&gt;Reusable anytime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Storage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Not stored&lt;/td&gt;
&lt;td&gt;Not stored&lt;/td&gt;
&lt;td&gt;Stored in DB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Complexity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Simple logic&lt;/td&gt;
&lt;td&gt;Moderate (supports recursion)&lt;/td&gt;
&lt;td&gt;Full programming logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use Case&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Filtering &amp;amp; aggregation&lt;/td&gt;
&lt;td&gt;Readability &amp;amp; modularity&lt;/td&gt;
&lt;td&gt;Business logic &amp;amp; automation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;subqueries&lt;/strong&gt; for quick, inline calculations or filters.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;CTEs&lt;/strong&gt; when you want better readability and the ability to reference results multiple times in a single query.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;stored procedures&lt;/strong&gt; when you need reusable, parameterized, and complex database logic.&lt;/li&gt;
&lt;li&gt;By understanding when to use each, you’ll write cleaner SQL, improve performance, and build maintainable database solutions.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Data-Driven Insights into Kenya’s Crop Production</title>
      <dc:creator>Mercy Musyoka</dc:creator>
      <pubDate>Tue, 26 Aug 2025 11:52:15 +0000</pubDate>
      <link>https://dev.to/impactbymercy/data-driven-insights-into-kenyas-crop-production-p88</link>
      <guid>https://dev.to/impactbymercy/data-driven-insights-into-kenyas-crop-production-p88</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Agriculture is one of the most important sectors in Kenya. It not only feeds millions of people but also provides jobs and income for many families. With farming being such a key part of the economy, it’s important to understand how different crops and regions are performing. That’s where data comes in.&lt;/p&gt;

&lt;p&gt;To dig deeper, I created a Power BI dashboard that shows trends in crop production, revenue, profit, and land use across several counties. The dashboard, called Kenya Crop Insights, makes it easy to see which crops bring in the most revenue, which counties are leading in production, and how costs and yields change over time. My goal with this project is to show how data visualization can turn numbers into useful insights that can guide farmers, policymakers, and even investors in making better decisions for the agricultural sector.&lt;br&gt;
The above can be shown using the image below of the dashboard I created&lt;br&gt;
&lt;em&gt;PLEASE NOTE THAT THE RESULTS BELOW DO NOT RELATE TO AN ACTUAL DATA SET&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F853af9h4jaf9esjhysn1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F853af9h4jaf9esjhysn1.png" alt=" " width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Overall Highlights (from the dashboard)
&lt;/h3&gt;

&lt;p&gt;From the dashboard, a few big-picture insights immediately stand out. Kenya’s crop sector generated Ksh 1.19 billion in total revenue, with Ksh 1.10 billion in profit, showing that farming activities across the counties are quite profitable overall. The data also shows a combined total yield of 1.23 million units (depending on whether measured in tons or kilograms) spread across a total land area of 4,930 hectares.&lt;/p&gt;

&lt;p&gt;What’s interesting here is the balance between land use and output. Even with less than 5,000 hectares under cultivation, farmers were able to achieve significant returns, pointing to the value of efficient farming practices and crop selection. These figures provide a snapshot of the sector’s strength while also highlighting areas where improvements in land utilization and productivity could unlock even greater results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Revenue and Production Costs by Month
&lt;/h3&gt;

&lt;p&gt;The data shows that revenue is consistently higher than production costs, meaning farming stays profitable throughout the year. However, there are clear ups and downs. Revenue peaks during harvest months, then dips slightly in between seasons. These shifts reflect the seasonal nature of farming in Kenya, where weather patterns and market demand affect performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Revenue by County
&lt;/h3&gt;

&lt;p&gt;Nyeri leads with the highest revenue at Ksh 162M, followed closely by Nairobi and Nakuru. This can be linked to factors such as fertile soil, better farming practices, good infrastructure, and easier access to markets. These advantages give farmers in these counties higher returns compared to others.&lt;/p&gt;

&lt;h3&gt;
  
  
  Land Area &amp;amp; Yield by County
&lt;/h3&gt;

&lt;p&gt;Nairobi and Kiambu stand out with both large land use and high yields. On the other hand, counties like Mombasa have smaller land areas and lower yields. This shows that productivity isn’t just about land size — good farming practices also play a big role in output.&lt;/p&gt;

&lt;h3&gt;
  
  
  Farmer-Level &amp;amp; Filters
&lt;/h3&gt;

&lt;p&gt;The dashboard can be filtered by crop type, farmer, county, or month. This makes it easy for farmers, policymakers, and investors to drill down into specific details and make better decisions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recommendations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Invest more in counties with high yield efficiency to maximize returns.&lt;/li&gt;
&lt;li&gt;Focus on profitable crops like rice, sorghum, and potatoes.&lt;/li&gt;
&lt;li&gt;Support underperforming counties by providing better inputs, irrigation, and access to markets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This analysis shows how data analytics can transform agriculture by making it more efficient and profitable. With tools like Power BI, raw data is turned into clear insights that help farmers, policymakers, and investors make informed decisions. By understanding trends in revenue, yield, and land use, Kenya’s agricultural sector can unlock more opportunities for growth and sustainability.&lt;/p&gt;

</description>
      <category>agriculture</category>
      <category>dataanalytics</category>
      <category>powerbi</category>
      <category>kenya</category>
    </item>
    <item>
      <title>Excel for Predictive Analysis: Friend or Foe in Data-Driven Decisions?</title>
      <dc:creator>Mercy Musyoka</dc:creator>
      <pubDate>Mon, 11 Aug 2025 15:26:03 +0000</pubDate>
      <link>https://dev.to/impactbymercy/excel-for-predictive-analysis-friend-or-foe-in-data-driven-decisions-1bo7</link>
      <guid>https://dev.to/impactbymercy/excel-for-predictive-analysis-friend-or-foe-in-data-driven-decisions-1bo7</guid>
      <description>&lt;h2&gt;
  
  
  &lt;u&gt;Introduction&lt;/u&gt;
&lt;/h2&gt;

&lt;p&gt;Love it or hate it, Excel has been running the world’s numbers for decades.&lt;br&gt;
From school projects to billion-dollar business plans, it’s everywhere.&lt;/p&gt;

&lt;p&gt;But can it actually keep up with predictive analysis — and should we trust it for serious data-driven business decisions?&lt;br&gt;
Let’s break it down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🚀 &lt;u&gt;Where Excel Shines in Predictive Analysis&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Everyone Knows It&lt;br&gt;
From interns to CEOs, Excel is universal. That means you can share a forecast, and everyone “gets it” without a data science degree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Built-in Forecasting Tools&lt;br&gt;
Functions like FORECAST.ETS and regression in the Data Analysis ToolPak let you project future trends quickly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flexible &amp;amp; Quick to Prototype&lt;br&gt;
Need a “what-if” sales model before lunch? Excel delivers with formulas, pivot tables, and charts — no setup headaches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Works With Many Data Sources&lt;br&gt;
CSV files, databases, Power BI… Excel pulls them in so you can mix datasets before predicting outcomes.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Below is how an excel looks like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruh2b43s28ofvbxtfhw0.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruh2b43s28ofvbxtfhw0.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;&lt;u&gt;⚠️ Where Excel Falls Short&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Struggles With Big Data&lt;br&gt;
Feed it millions of rows, and it’ll slow down or crash.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Human Error Risk&lt;br&gt;
One misplaced formula and your forecast could go off the rails.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic Statistics Only&lt;br&gt;
Fine for regression, weak for advanced predictive models.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Messy Collaboration&lt;br&gt;
Multiple editors often mean broken formulas and version chaos.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;strong&gt;💡&lt;u&gt;Excel’s Role in Data-Driven Decisions&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Excel may not be a machine learning powerhouse, but it’s the perfect starting point for data-driven thinking:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Model business scenarios fast.&lt;/li&gt;
&lt;li&gt;Make insights clear with charts and conditional formatting.&lt;/li&gt;
&lt;li&gt;Share forecasts in a format everyone understands.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;_Example: A retailer can forecast holiday sales, test stock scenarios, and decide inventory levels — all in one afternoon.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🎯&lt;u&gt;The Verdict&lt;/u&gt;&lt;/strong&gt;&lt;br&gt;
Excel is your quick-thinking friend: great for starting the conversation, not for running the entire predictive analysis show.&lt;br&gt;
Pair it with dedicated analytics tools when your data (or decisions) get bigger and more complex.&lt;/p&gt;




&lt;p&gt;💬 What’s your take — is Excel underappreciated or overrated in predictive analytics?&lt;/p&gt;

</description>
      <category>dataanalytics</category>
      <category>beginners</category>
      <category>datadriven</category>
      <category>excel</category>
    </item>
    <item>
      <title>How to Install &amp; Set Up PostgreSQL on Linux (Beginner Friendly)-UBUNTU</title>
      <dc:creator>Mercy Musyoka</dc:creator>
      <pubDate>Fri, 01 Aug 2025 13:48:48 +0000</pubDate>
      <link>https://dev.to/impactbymercy/how-to-install-set-up-postgresql-on-linux-beginner-friendly-ubuntu-o9</link>
      <guid>https://dev.to/impactbymercy/how-to-install-set-up-postgresql-on-linux-beginner-friendly-ubuntu-o9</guid>
      <description>&lt;h1&gt;
  
  
  How to Install PostgreSQL and Set It Up on a Linux Server
&lt;/h1&gt;

&lt;p&gt;PostgreSQL is a powerful, open-source relational database system used by developers, startups, and large enterprises worldwide.  &lt;/p&gt;

&lt;h2&gt;
  
  
  In this guide, I will walk you through installing PostgreSQL on a Linux server and doing a basic setup so you can start using it right away.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before you begin, make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Linux server (Ubuntu/Debian or CentOS/RHEL)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;sudo&lt;/strong&gt; or root access&lt;/li&gt;
&lt;li&gt;An internet connection&lt;/li&gt;
&lt;li&gt;Terminal(I used git bash)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠 Step 1: Access Your Linux Server
&lt;/h2&gt;

&lt;p&gt;First, connect to your Linux server via SSH:&lt;br&gt;
&lt;code&gt;ssh username@server_ip_address&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;1.Replace the username with server's user(for example in my case mawia)&lt;br&gt;
2.Replace the server_ip_address with your server's ip address&lt;/p&gt;

&lt;p&gt;You can as well choose to specify the port after inputing the above( -p 22) but its not a must &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5olldrqsphsgp2i8q2pb.jpg" alt=" " width="800" height="416"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 2: View Files and Directories
&lt;/h2&gt;

&lt;p&gt;Once connected, you can check the contents of your home directory:&lt;br&gt;
This can be done by;&lt;br&gt;
&lt;code&gt;ls&lt;/code&gt; command on the terminal you are using&lt;br&gt;
This helps confirm you’re in the right place before proceeding.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjasqagjtzszt1fbc3ycn.jpg" alt=" " width="800" height="417"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 3: Update the System
&lt;/h2&gt;

&lt;p&gt;It’s best to ensure your system is up-to-date before installing software to avoid vulnerabilities and compatibility issues.&lt;br&gt;
If using Ubuntu, you can use the command;&lt;br&gt;
&lt;code&gt;sudo apt update&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn4jsqm0rvtjz1yll7iac.jpg" alt=" " width="800" height="419"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 4: Install PostgreSQL
&lt;/h2&gt;

&lt;p&gt;The command used in ubuntu is;&lt;br&gt;
&lt;code&gt;sudo apt install postgresql postgresql-contrib -y&lt;/code&gt;&lt;br&gt;
After inputing this command you will be asked to choose yes or no please choose &lt;strong&gt;yes&lt;/strong&gt; so as to continue with the process of installation as shown below;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frm05t664kq5q2gj9bmch.jpg" alt=" " width="800" height="419"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 5: Check whether you have PostgreSQL /start
&lt;/h2&gt;

&lt;p&gt;You use the command;&lt;br&gt;
&lt;code&gt;sudo systemctl start PostgreSQL&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1jg4c3gf109l3e05d18d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1jg4c3gf109l3e05d18d.jpg" alt=" " width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  For example, from the above the state is active
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 6:Check the version of PostgreSQL
&lt;/h2&gt;

&lt;p&gt;You use the command;&lt;br&gt;
&lt;code&gt;psql --version&lt;/code&gt;&lt;br&gt;
For example my version was 16.9 from the screenshot I took below.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3jt52rlpqmjste6qmyok.jpg" alt=" " width="800" height="417"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 7:Now Enable the PostgreSQL
&lt;/h2&gt;

&lt;p&gt;use the command;&lt;br&gt;
&lt;code&gt;sudo systemctl enable postresql&lt;/code&gt;&lt;br&gt;
As show below, the PostgreSQL is now active.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4z5s43a2i7ixw9i4lb4f.jpg" alt=" " width="800" height="420"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 8:Check Status
&lt;/h2&gt;

&lt;p&gt;use the command;&lt;br&gt;
&lt;code&gt;sudo systemctl status postgesql&lt;/code&gt;&lt;br&gt;
Expect something the this;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9gzjy0i8k4b97z944vwk.jpg" alt=" " width="800" height="420"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠 Step 9: Now its time to interact with the PostgreSQL
&lt;/h2&gt;

&lt;p&gt;Now that PostgreSQL is installed and running, let’s log in and create our first database.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠 Switching to PostgreSQL default user
&lt;/h3&gt;

&lt;p&gt;PostgreSQL creates a default Linux user called &lt;code&gt;postgres&lt;/code&gt;. Switch to it:&lt;br&gt;
we use the command;&lt;br&gt;
&lt;code&gt;sudo -i -u postresql&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;i- stands for interface&lt;/li&gt;
&lt;li&gt;u- user&lt;/li&gt;
&lt;li&gt;postgresql is the default Postresql user&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr78bql38qtlnuufzl3fj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr78bql38qtlnuufzl3fj.jpg" alt=" " width="800" height="412"&gt;&lt;/a&gt;&lt;br&gt;
You should see your prompt change to:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;postgres@myvm:~$&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛠 Access the PostgreSQL Shell
&lt;/h3&gt;

&lt;p&gt;Sinceyou’re the postgres user, open the PostgreSQL interactive terminal using the command;&lt;br&gt;
&lt;code&gt;psql&lt;/code&gt;&lt;br&gt;
Example of the result to ecpect is shown below;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4a6y55wf1cwsw0br7kh2.jpg" alt=" " width="800" height="422"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛠 Now list the databases created
&lt;/h3&gt;

&lt;p&gt;Using the command,&lt;br&gt;
&lt;code&gt;\l&lt;/code&gt;&lt;br&gt;
The default database is postgres as shown below;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl610pl909ezhkocw85r8.jpg" alt=" " width="800" height="419"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛠 Create a new database
&lt;/h3&gt;

&lt;p&gt;Inside the psql shell, now create a new database&lt;br&gt;
using the command;&lt;br&gt;
&lt;code&gt;create database nameofdatabase;&lt;/code&gt;&lt;br&gt;
Remember to terminate the query &lt;br&gt;
for example in my case I was creating a database named student.&lt;br&gt;
so i used the command;&lt;br&gt;
&lt;code&gt;create database student&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh0ms9x456xx9r195xd3s.jpg" alt=" " width="800" height="416"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛠 create user
&lt;/h3&gt;

&lt;p&gt;Now create user, with the command;&lt;br&gt;
&lt;code&gt;create user nameofuser with password 'passwordofchoice'&lt;/code&gt;&lt;br&gt;
eg in my case;&lt;br&gt;
&lt;code&gt;create user lux with password '1234';&lt;/code&gt;&lt;br&gt;
Remember to &lt;strong&gt;terminate the query&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feq0xflik6tgqv1znmb32.jpg" alt=" " width="800" height="414"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛠Grant user access to the database user
&lt;/h3&gt;

&lt;p&gt;using the command;&lt;br&gt;
&lt;code&gt;GRANT ALL PRIVILIGES ON DATABASE nameofdatabase TO username&lt;/code&gt;&lt;br&gt;
for example in my case,&lt;br&gt;
&lt;code&gt;GRANT ALL PRIVILEGES ON DATABASE STUDENT TO LUX&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fexeilntysut65c48r09q.jpg" alt=" " width="800" height="415"&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🛠 Now check the databases created
&lt;/h3&gt;

&lt;p&gt;This can be done by using the command;&lt;br&gt;
&lt;code&gt;\l&lt;/code&gt;&lt;br&gt;
yow will see the default one which is postgres and the one you just created in my case it was student.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fblq2z9191i9s0k67xxo7.jpg" alt=" " width="800" height="416"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  WRAPPING UP!
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Congratulations!!!!!!!!!!!!!!!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  You have successfully installed and set up PostgreSQL on ubuntu, created your first database, and learned how to view all the available databases with the &lt;code&gt;\l&lt;/code&gt; command.
&lt;/h2&gt;

&lt;p&gt;From here, you can connect PostgreSQL to your favorite tool and applications. For example, you  might  use a postgreSQL GUI tool like &lt;strong&gt;pgDdmin&lt;/strong&gt; or &lt;strong&gt;DBeaver&lt;/strong&gt;, or connect directly from a programming language like python,Node.js or Java.&lt;/p&gt;

&lt;p&gt;Here is the general format for a PostgreSQL connecting string: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;postgesql://username:password@host:5432/databasename&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;from the above replace &lt;code&gt;username&lt;/code&gt; ,&lt;code&gt;password&lt;/code&gt; &lt;code&gt;host&lt;/code&gt; and &lt;code&gt;databasename&lt;/code&gt; with your own values.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exiting PostgreSQL and the Terminal
&lt;/h2&gt;

&lt;p&gt;When you're done:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;leave the PostgreSQL shell by typing the command;
&lt;code&gt;\q&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If you are connected to your ubuntu server via SSH, log out by typing the command;
&lt;code&gt;exit&lt;/code&gt;
--- 
&lt;strong&gt;That's it!!!!&lt;/strong&gt;
You are ready now to start building applications backed by a powerful PostgreSQL database. Whether you're developing locally or deploying to production, this setup will give you a reliable foundation for storing and managing your data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h4&gt;
  
  
  QUERY ON BUDDDY!!!!!!!!**
&lt;/h4&gt;

</description>
      <category>postgressql</category>
      <category>linux</category>
      <category>database</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
