<?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>Forem: s mathavi</title>
    <description>The latest articles on Forem by s mathavi (@s_mathavi_2fa1e3ea8514f34).</description>
    <link>https://forem.com/s_mathavi_2fa1e3ea8514f34</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%2F3250662%2Fc02e860f-3eda-41e7-a98f-3f6dcb800874.jpg</url>
      <title>Forem: s mathavi</title>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/s_mathavi_2fa1e3ea8514f34"/>
    <language>en</language>
    <item>
      <title>PostgreSQL(Alternations)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Fri, 20 Mar 2026 09:12:09 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresqlalternations-2en3</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresqlalternations-2en3</guid>
      <description>&lt;p&gt;-ALTER TABLE → modify existing table structure.&lt;br&gt;
-Operations: add/drop column, change datatype, rename column/table, add/drop constraints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common ALTER TABLE Operations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Add a new column&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ALTER TABLE Employee&lt;br&gt;
ADD COLUMN email VARCHAR(100);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Drop (remove) a column&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ALTER TABLE Employee&lt;br&gt;
DROP COLUMN email;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Change datatype of a column&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
ALTER TABLE Employee&lt;br&gt;
ALTER COLUMN salary TYPE NUMERIC(12,2);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Rename a column&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ALTER TABLE Employee&lt;br&gt;
RENAME COLUMN name TO full_name;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Add a constraint&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ALTER TABLE Employee&lt;br&gt;
ADD CONSTRAINT salary_positive CHECK (salary &amp;gt; 0);&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Drop a constraint&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ALTER TABLE Employee&lt;br&gt;
DROP CONSTRAINT salary_positive;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Rename the table itself&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ALTER TABLE Employee&lt;br&gt;
RENAME TO Staff;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is the basic PostgreSQL...&lt;/p&gt;

&lt;p&gt;See you soon in the next blog!....&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>sql</category>
      <category>mysql</category>
      <category>database</category>
    </item>
    <item>
      <title>PostgreSql(Filtering &amp; Sorting)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Fri, 20 Mar 2026 09:01:03 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresqlfiltering-sorting-41ka</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresqlfiltering-sorting-41ka</guid>
      <description>&lt;p&gt;&lt;strong&gt;Filtering (WHERE clause)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Filtering means → only certain rows are selected based on a condition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;55000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;salary&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;60000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Meena&lt;/td&gt;
&lt;td&gt;58000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Arun&lt;/td&gt;
&lt;td&gt;62000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Sorting (ORDER BY clause)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sorting means → arrange rows in ascending (ASC) or descending (DESC) order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See you soon in the next topic!.......&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>mysql</category>
      <category>database</category>
      <category>sql</category>
    </item>
    <item>
      <title>PostgreSql(Aggregative Functions)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Fri, 20 Mar 2026 08:48:55 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresqlaggregative-functions-2bf5</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresqlaggregative-functions-2bf5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Aggregative Function:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Aggregate functions perform calculations on multiple rows and return a single result. &lt;/p&gt;

&lt;p&gt;They’re essential for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Summarizing data (e.g., total salary, average marks)&lt;/li&gt;
&lt;li&gt;Analyzing trends (e.g., highest sales, number of employees per department)&lt;/li&gt;
&lt;li&gt;Filtering grouped results using HAVING&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;#Common SQL Aggregate Functions:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;MAX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using Aggregate Functions with GROUP BY:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;AVG&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Filtering Groups with HAVING&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;emp_count&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;dept_id&lt;/span&gt;
&lt;span class="k"&gt;HAVING&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shows only departments with more than 5 employees.&lt;/p&gt;

&lt;p&gt;Bye.. bye..&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>sql</category>
      <category>database</category>
      <category>mysql</category>
    </item>
    <item>
      <title>PostgreSQL-constraints</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Fri, 20 Mar 2026 07:38:28 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresql-constraints-2bng</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresql-constraints-2bng</guid>
      <description>&lt;p&gt;&lt;strong&gt;Constraints:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constraints are the backbone of reliable database design. They act like safety checks, ensuring that every piece of data stored is valid, consistent, and meaningful.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Types of Constraints&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.PRIMARY KEY&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Ensures each row has a unique identifier.&lt;br&gt;
-No duplicates, no NULL values.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;emp_id SERIAL PRIMARY KEY&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.FOREIGN KEY&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Creates a relationship between two tables.&lt;br&gt;
-Ensures values in one table match values in another.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dept_id INT REFERENCES Department(dept_id)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.UNIQUE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Guarantees that all values in a column are distinct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;email VARCHAR(150) UNIQUE&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. NOT NULL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Prevents empty values in a column.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;name VARCHAR(100) NOT NULL&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5.DEFAULT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Assigns an automatic value if none is provided during insertion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;status VARCHAR(20) DEFAULT 'Active'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. CHECK&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Validates data against a condition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;salary NUMERIC(10,2) CHECK (salary &amp;gt; 0)&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Example table:
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;emp_id&lt;/span&gt; &lt;span class="nb"&gt;SERIAL&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;Department&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="nb"&gt;NUMERIC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;'Active'&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why Constraints Matter&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-Data Integrity: Prevents invalid or duplicate entries.&lt;br&gt;
-Consistency: Enforces business rules (e.g., salary must be positive).&lt;br&gt;
-Relationships: Maintains links between tables.&lt;br&gt;
-Reliability: Ensures queries always return valid data.&lt;/p&gt;

&lt;p&gt;Next blog is Relationship(joins) in PostgreSql....&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>sql</category>
      <category>java</category>
      <category>mysql</category>
    </item>
    <item>
      <title>PostgreSql - Relationships(joins)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Fri, 20 Mar 2026 07:38:05 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresql-relationshipsjoins-4c6o</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/postgresql-relationshipsjoins-4c6o</guid>
      <description>&lt;p&gt;How to connect Two Database in innerjoin?&lt;br&gt;
1.Most Important step is Create Extension.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CREATE EXTENSION dblink;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;dblink&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'dbname=department_db'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s1"&gt;'SELECT dept_id, dept_name FROM Department'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dept_name&lt;/span&gt; &lt;span class="nb"&gt;TEXT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;department_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;&lt;strong&gt;Same Database:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT e.name, d.dept_name&lt;br&gt;
FROM Employee e&lt;br&gt;
INNER JOIN Department d&lt;br&gt;
ON e.dept_id = d.dept_id;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we Start ,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tables Setup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Employee table:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;emp_id&lt;/th&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_id&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Mathavi&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Kumar&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Meena&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Department table:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;dept_id&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  INNER JOIN
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;INNER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Department&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mathavi&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kumar&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;!..Only employees with valid department.&lt;/p&gt;

&lt;h2&gt;
  
  
  LEFT JOIN
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;LEFT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Department&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kumar&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Meena&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;!..All employees shown, even Meena (no department → NULL).&lt;/p&gt;

&lt;h1&gt;
  
  
  RIGHT JOIN
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;RIGHT&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Department&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kumar&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;!..All departments shown, even Marketing (no employee → NULL).&lt;/p&gt;

&lt;h2&gt;
  
  
  FULL OUTER JOIN
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;FULL&lt;/span&gt; &lt;span class="k"&gt;OUTER&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Department&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kumar&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Meena&lt;/td&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;NULL&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;!..Combines LEFT + RIGHT → all employees + all departments.&lt;/p&gt;

&lt;h2&gt;
  
  
  CROSS JOIN
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dept_name&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;Employee&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;
&lt;span class="k"&gt;CROSS&lt;/span&gt; &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;Department&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;name&lt;/th&gt;
&lt;th&gt;dept_name&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;HR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Udaya&lt;/td&gt;
&lt;td&gt;Marketing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;IT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Priya&lt;/td&gt;
&lt;td&gt;Finance&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;... (every combination)&lt;/p&gt;

&lt;p&gt;!..Every employee paired with every department.&lt;/p&gt;

&lt;p&gt;Our next blog is Aggregate Function....&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
      <category>postgressql</category>
      <category>innerjoin</category>
    </item>
    <item>
      <title>postgreSQL - CRUD</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Thu, 19 Mar 2026 20:52:04 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/installation-for-postgresql-327i</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/installation-for-postgresql-327i</guid>
      <description>&lt;p&gt;&lt;strong&gt;why postgreSQL?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PostgreSQL is popular because it offers enterprise‑grade reliability, modern features, and zero licensing costs, making it the go‑to database for both small projects and large‑scale systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;br&gt;
1.Open your terminal.&lt;br&gt;
2.update package - &lt;code&gt;sudo apt update&lt;/code&gt;&lt;br&gt;
3.Install PostgreSQL and contrib packages - &lt;code&gt;sudo apt install postgresql postgresql-contrib&lt;/code&gt;&lt;br&gt;
4.Verify installation: - &lt;code&gt;psql --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Steps: Initialize and Use PostgreSQL&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Switch to the postgres user - &lt;code&gt;sudo -i -u postgres
&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Enter the PostgreSQL shell - &lt;code&gt;psql&lt;/code&gt;
Now the prompt like &lt;code&gt;postgres=#&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.create database - &lt;code&gt;CREATE DATABASE Employee_DB;&lt;/code&gt;&lt;br&gt;
will actually be stored as &lt;code&gt;employee_db&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;4.list of database -&lt;code&gt;\l&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Drop query&lt;/strong&gt;: drop database embloyee_db;&lt;/p&gt;

&lt;p&gt;!...semicolon is important for each query.&lt;/p&gt;

&lt;p&gt;5.Then connect - &lt;code&gt;\c employee_db&lt;/code&gt; (Enter to which data we will use)&lt;br&gt;
6.check connect - It is looking like this (embloyee_db=#)&lt;br&gt;
7.create table - &lt;code&gt;CREATE TABLE Employee (&lt;br&gt;
    emp_id SERIAL PRIMARY KEY,&lt;br&gt;
    name VARCHAR(100),&lt;br&gt;
    department_id INT,&lt;br&gt;
    salary NUMERIC(10,2)&lt;br&gt;
);&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SERIAL → auto number generate.&lt;/li&gt;
&lt;li&gt;PRIMARY KEY → unique identity.&lt;/li&gt;
&lt;li&gt;VARCHAR → text (length limit).&lt;/li&gt;
&lt;li&gt;INT → whole number.&lt;/li&gt;
&lt;li&gt;NUMERIC(10,2) → decimal number (money, salary).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;8.If you want one more column in table we use &lt;strong&gt;Alter&lt;/strong&gt; - &lt;code&gt;ALTER TABLE Employee ADD COLUMN email VARCHAR(100);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;9.give Default value for column automatic assign value - &lt;code&gt;ALTER TABLE Employee ADD COLUMN bonus INT DEFAULT 100;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;10.Column name changing - &lt;code&gt;ALTER TABLE Employee&lt;br&gt;
RENAME COLUMN department_id TO dept_id;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;11.drop column - &lt;code&gt;ALTER TABLE EMPLOYEE DROP COLUMN bonus;&lt;/code&gt;&lt;br&gt;
!!..if we drop one column we lose all the columns datas so use it carefully.&lt;/p&gt;

&lt;p&gt;12.Table list - &lt;code&gt;\dl&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;13.Table Strucuture - &lt;code&gt;\d table_name&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;14.Table view - &lt;code&gt;SELECT * FROM Employee;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;15.Values Inserting - INSERT INTO Employee(name,department_id,salary,email)VALUES('udaya',2,&lt;a href="mailto:msudaya@gmail.com"&gt;msudaya@gmail.com&lt;/a&gt;,80000,);&lt;/p&gt;

&lt;p&gt;16.update - &lt;code&gt;UPDATE Employee&lt;br&gt;
SET department_id = 3&lt;br&gt;
WHERE emp_id = 1;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
17.delete ROW - &lt;code&gt;DELETE FROM Employee WHERE emp_id = 1&lt;/code&gt;;&lt;/p&gt;

&lt;p&gt;Next blog we will discuss about constraints,Relationships(joins),Aggregate Function,Filtering &amp;amp; Sorting,Table alternations.....&lt;/p&gt;

&lt;p&gt;see u soon...!!!!&lt;/p&gt;

</description>
      <category>sql</category>
      <category>postgressql</category>
      <category>java</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Part-4 Functional Interface(Supplier)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Tue, 03 Mar 2026 09:32:28 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-4-functional-interfacesupplier-5f2b</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-4-functional-interfacesupplier-5f2b</guid>
      <description>&lt;p&gt;&lt;strong&gt;Supplier:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A functional interface in java.util.function.&lt;/li&gt;
&lt;li&gt;Represents a value provider: it returns a value but takes no input.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Core method:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;T get()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Opposite of Consumer:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Consumer → takes input, no return.&lt;/em&gt;&lt;br&gt;
  &lt;em&gt;Supplier → no input, returns output.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Often used for lazy initialization, default values, or generating data (like random numbers, timestamps, IDs).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: Basic Supplier&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Supplier;
public class SupplierDemo {
    public static void main(String[] args) {

        // Supplier that generates a random number
        Supplier&amp;lt;Double&amp;gt; randomSupplier = () -&amp;gt; Math.random();

        // Each call to get() produces a new value
        System.out.println("Random 1: " + randomSupplier.get());
        System.out.println("Random 2: " + randomSupplier.get());
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example: Supplier for Default Value&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Supplier;

public class DefaultValueDemo {
    public static void main(String[] args) {

        Supplier&amp;lt;String&amp;gt; defaultName = () -&amp;gt; "Unknown User";

        String name = null;
        String finalName = (name != null) ? name : defaultName.get();

        System.out.println("Name: " + finalName); // Output: Name: Unknown User
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Specialized Suppliers:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Java also provides primitive-specialized suppliers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; IntSupplier → returns int.&lt;/li&gt;
&lt;li&gt; LongSupplier → returns long.&lt;/li&gt;
&lt;li&gt; DoubleSupplier → returns double.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.IntSupplier;

public class IntSupplierDemo {
    public static void main(String[] args) {
        IntSupplier diceRoll = () -&amp;gt; (int)(Math.random() * 6) + 1;
        System.out.println("Dice rolled: " + diceRoll.getAsInt());
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading — talk to you soon.&lt;/p&gt;

</description>
      <category>java</category>
      <category>java8</category>
      <category>functionalinterface</category>
      <category>supplier</category>
    </item>
    <item>
      <title>Part-4 Functional Interface(Function)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Tue, 03 Mar 2026 09:09:17 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-4-functional-interfacefunction-3555</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-4-functional-interfacefunction-3555</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Function&lt;/em&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A functional interface in java.util.function.&lt;/li&gt;
&lt;li&gt;Represents a transformation: takes an input of type T and produces an output of type R.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Core Method:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;R apply(T t)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extra Methods in Function:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Function is more powerful than Consumer because it supports chaining both before and after.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. andThen(Function after)&lt;/strong&gt;&lt;br&gt;
First applies the current function, then applies the after function on the result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Function&amp;lt;String, Integer&amp;gt; lengthFinder = str -&amp;gt; str.length();
Function&amp;lt;Integer, Integer&amp;gt; square = n -&amp;gt; n * n;

Function&amp;lt;String, Integer&amp;gt; lengthSquared = lengthFinder.andThen(square);

System.out.println(lengthSquared.apply("Java")); // 16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. compose(Function before)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First applies the before function, then applies the current function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Function&amp;lt;Integer, Integer&amp;gt; square = n -&amp;gt; n * n;
Function&amp;lt;Integer, String&amp;gt; toString = n -&amp;gt; "Result: " + n;

Function&amp;lt;Integer, String&amp;gt; squareThenString = toString.compose(square);

System.out.println(squareThenString.apply(5)); // Result: 25

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example for Compose&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Function;

public class FunctionOrderDemo {
    public static void main(String[] args) {

        Function&amp;lt;Integer, Integer&amp;gt; add2 = n -&amp;gt; n + 2;
        Function&amp;lt;Integer, Integer&amp;gt; multiply3 = n -&amp;gt; n * 3;

        // andThen → current first, then after
        System.out.println(add2.andThen(multiply3).apply(5));  
        // (5 + 2) * 3 = 21

        // compose → before first, then current
        System.out.println(add2.compose(multiply3).apply(5));  
        // (5 * 3) + 2 = 17
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Why not just use andThen always?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;-If you always want current → after, andThen is enough.&lt;br&gt;
-But sometimes you need the other order (before → current).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;-You want to preprocess input before applying your main function.&lt;br&gt;
-That’s when compose is useful.&lt;/p&gt;

&lt;p&gt;I think it is useful to everyone see u Soon....&lt;/p&gt;

</description>
      <category>java8</category>
      <category>java</category>
      <category>functionalinterface</category>
      <category>function</category>
    </item>
    <item>
      <title>Part-3 Functional Interface (Consumer)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Tue, 03 Mar 2026 08:04:53 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-3-functional-interface-consumer-1fia</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-3-functional-interface-consumer-1fia</guid>
      <description>&lt;p&gt;&lt;strong&gt;Consumer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consumer is an interface in java. &lt;/li&gt;
&lt;li&gt;A functional interface in &lt;code&gt;java.util.function&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Represents an operation that takes one input and returns nothing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Core method:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;void accept(T t)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extra Methods in Consumer:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;andThen(Consumer after)&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chains two Consumers together.&lt;/li&gt;
&lt;li&gt;First executes the current Consumer, then executes the after Consumer.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Consumer&amp;lt;String&amp;gt; print = s -&amp;gt; System.out.println(s);
Consumer&amp;lt;String&amp;gt; printUpper = s -&amp;gt; System.out.println(s.toUpperCase());

Consumer&amp;lt;String&amp;gt; combined = print.andThen(printUpper);

combined.accept("hello");
// Output:
// hello
// HELLO
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Specialized Consumers:&lt;/strong&gt;&lt;br&gt;
Java also provides specialized versions of Consumer for different use cases:&lt;br&gt;
   &lt;code&gt;BiConsumer&amp;lt;T,U&amp;gt;&lt;/code&gt;&lt;br&gt;
-Accepts two inputs, performs an action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;BiConsumer&amp;lt;String, Integer&amp;gt; printNameAge =
    (name, age) -&amp;gt; System.out.println(name + " is " + age + " years old");

printNameAge.accept("Ravi", 25);
// Output: Ravi is 25 years old
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Primitive Consumer Interfaces:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Normal Consumer uses objects (like Integer), but when dealing with primitives like int, long, or double, that would cause unnecessary boxing/unboxing. So we have these specialized interfaces to handle primitives efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. IntConsumer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: A Consumer that takes an int and performs an action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;IntConsumer printSquare = n -&amp;gt; System.out.println(n * n);
printSquare.accept(5); // Output: 25
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Definition: A Consumer that takes a long and performs an action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;LongConsumer printHalf = l -&amp;gt; System.out.println(l / 2);
printHalf.accept(100L); // Output: 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. DoubleConsumer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Definition: A Consumer that takes a double and performs an action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DoubleConsumer printDoubleValue = d -&amp;gt; System.out.println(d * 2);
printDoubleValue.accept(3.5); // Output: 7.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See u Soon... we will meet at the next Amazing blog!.....&lt;/p&gt;

</description>
      <category>java</category>
      <category>java8</category>
      <category>consumerinterface</category>
      <category>functionalinterface</category>
    </item>
    <item>
      <title>Part-2 Why Functional Interfaces Matter in Java 8(Predicate)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Wed, 21 Jan 2026 16:36:49 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-2-why-functional-interfaces-matter-in-java-8-9p6</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/part-2-why-functional-interfaces-matter-in-java-8-9p6</guid>
      <description>&lt;p&gt;Now we will discussed about the part2 of Functional Interface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;1.Predicate:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Predicate is a functional interface in Java &lt;code&gt;(java.util.function.Predicate&amp;lt;T&amp;gt;)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;It has exactly one abstract method:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@FunctionalInterface
public interface Predicate&amp;lt;T&amp;gt; {
    boolean test(T t);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Input: one value of type T&lt;/li&gt;
&lt;li&gt;Output: true or false&lt;/li&gt;
&lt;li&gt;Purpose: Used for condition checking.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Basic Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Predicate;

public class PredicateDemo {
    public static void main(String[] args) {
        Predicate&amp;lt;Integer&amp;gt; isEven = n -&amp;gt; n % 2 == 0;

        System.out.println(isEven.test(10)); // true
        System.out.println(isEven.test(7));  // false
    }
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Predicate Chaining&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Predicates can be combined:&lt;br&gt;
-and() → both conditions must be true&lt;br&gt;
-or() → at least one condition must be true&lt;br&gt;
-negate() → opposite of condition&lt;/p&gt;

&lt;p&gt;Example: Employee Age and Salary&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Employee {
    String name;
    int age;
    double salary;
    Employee(String n, int a, double s) { name = n; age = a; salary = s; }
}

Predicate&amp;lt;Employee&amp;gt; isAdult = e -&amp;gt; e.age &amp;gt; 18;
Predicate&amp;lt;Employee&amp;gt; highSalary = e -&amp;gt; e.salary &amp;gt; 50000;

Predicate&amp;lt;Employee&amp;gt; eligible = isAdult.and(highSalary);

System.out.println(eligible.test(new Employee("Ravi", 25, 60000))); // true
System.out.println(eligible.test(new Employee("Anu", 17, 70000)));  // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Negate Condition&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Predicate&amp;lt;Integer&amp;gt; isEven = n -&amp;gt; n % 2 == 0;
Predicate&amp;lt;Integer&amp;gt; isOdd = isEven.negate();

System.out.println(isOdd.test(5)); // true
System.out.println(isOdd.test(8)); // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Negate turns even check → odd check.&lt;/p&gt;




&lt;p&gt;We’ll continue exploring more Java concepts in the next blog. See you soon!&lt;/p&gt;

</description>
      <category>java</category>
      <category>java8</category>
      <category>functionalinterface</category>
      <category>predicate</category>
    </item>
    <item>
      <title>Why Functional Interfaces Matter in Java 8(Part-1:MethodReference)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Tue, 20 Jan 2026 17:25:30 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/why-functional-interfaces-matter-in-java-8part-1-2he5</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/why-functional-interfaces-matter-in-java-8part-1-2he5</guid>
      <description>&lt;p&gt;A &lt;strong&gt;&lt;em&gt;functional interface&lt;/em&gt;&lt;/strong&gt; in Java is an interface that has only one abstract method, making it suitable for use with lambda expressions and method references (introduced in Java 8).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Use &lt;code&gt;@_FunctionalInterface&lt;/code&gt;_ to ensure only one abstract method (annotation is optional).&lt;/li&gt;
&lt;li&gt; Enable clean, concise code using lambdas and method references.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Meaning of Method Reference&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A method reference is simply a shortcut syntax for a lambda expression.&lt;/li&gt;
&lt;li&gt;When a lambda expression is only calling an existing method, instead of writing the full lambda, you can directly refer to that method.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Syntax looks like:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ClassName::staticMethodName
objectReference::instanceMethodName
ClassName::new (for constructors)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Types of MethodReference:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Static Method Reference&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Function;
public class MethodRefDemo {
    public static int square(int n) {
        return n * n;
    }

    public static void main(String[] args) {
        // Lambda style
        Function&amp;lt;Integer, Integer&amp;gt; f1 = n -&amp;gt; MethodRefDemo.square(n);

        // Method reference style
        Function&amp;lt;Integer, Integer&amp;gt; f2 = MethodRefDemo::square;

        System.out.println(f1.apply(5)); // 25
        System.out.println(f2.apply(6)); // 36
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 2: Instance Method Reference&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Consumer;
public class MethodRefDemo2 {
    public void printMsg(String msg) {
        System.out.println(msg);
    }

    public static void main(String[] args) {
        MethodRefDemo2 obj = new MethodRefDemo2();

        // Lambda style
        Consumer&amp;lt;String&amp;gt; c1 = s -&amp;gt; obj.printMsg(s);

        // Method reference style
        Consumer&amp;lt;String&amp;gt; c2 = obj::printMsg;

        c1.accept("Hello Lambda");
        c2.accept("Hello Method Reference");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 3: Constructor Reference&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.Supplier;

class Employee {
    Employee() {
        System.out.println("Employee object created!");
    }
}

public class ConstructorRefDemo {
    public static void main(String[] args) {
        // Lambda style
        Supplier&amp;lt;Employee&amp;gt; s1 = () -&amp;gt; new Employee();

        // Constructor reference style
        Supplier&amp;lt;Employee&amp;gt; s2 = Employee::new;

        s1.get();
        s2.get();
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Multiple‑Parameter Constructor&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.function.BiFunction;
class Product {
    String name;
    double price;

    Product(String name, double price) {
        this.name = name;
        this.price = price;
        System.out.println("Product created: " + name + " - " + price);
    }
}

public class ConstructorRefDemo3 {
    public static void main(String[] args) {
        // Lambda style
        BiFunction&amp;lt;String, Double, Product&amp;gt; f1 = (n, p) -&amp;gt; new Product(n, p);

        // Constructor reference style
        BiFunction&amp;lt;String, Double, Product&amp;gt; f2 = Product::new;

        f1.apply("Laptop", 75000.0);   // Product created: Laptop - 75000.0
        f2.apply("Phone", 25000.0);    // Product created: Phone - 25000.0
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for Reading......&lt;br&gt;
That’s it for this blog—see you in the next java8 one!&lt;/p&gt;

</description>
      <category>java8</category>
      <category>webdev</category>
      <category>java</category>
      <category>functionalinterface</category>
    </item>
    <item>
      <title>Java-8 (Using lambdas with collections)</title>
      <dc:creator>s mathavi</dc:creator>
      <pubDate>Mon, 19 Jan 2026 11:26:44 +0000</pubDate>
      <link>https://forem.com/s_mathavi_2fa1e3ea8514f34/java-8-using-lambdas-with-collections-26e7</link>
      <guid>https://forem.com/s_mathavi_2fa1e3ea8514f34/java-8-using-lambdas-with-collections-26e7</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why Collection In Lambda?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;most of collections are used for store the data.&lt;/li&gt;
&lt;li&gt;In java8 gives a lambda+stream so easy for handling.&lt;/li&gt;
&lt;li&gt;we also have a concise code.
&lt;em&gt;Example 1: forEach with List&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.*;
public class LambdaListDemo {
    public static void main(String[] args) {
        List&amp;lt;String&amp;gt; names = Arrays.asList("Ravi", "Anu", "Kumar");

        // Lambda in forEach
        names.forEach(n -&amp;gt; System.out.println("Name: " + n));
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Example 2: Sorting with Comparator&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.*;
public class LambdaSortDemo {
    public static void main(String[] args) {
        List&amp;lt;String&amp;gt; names = Arrays.asList("Ravi", "Anu", "Kumar");

        // Sort using lambda comparator
        Collections.sort(names, (a, b) -&amp;gt; a.compareTo(b));

        System.out.println(names);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Example 3: Using Lambdas with Map (Key-Value)&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.*;
public class LambdaMapIteration {
    public static void main(String[] args) {
        Map&amp;lt;Integer, String&amp;gt; students = new HashMap&amp;lt;&amp;gt;();
        students.put(1, "Ravi");
        students.put(2, "Anu");
        students.put(3, "Kumar");

        // Iterate map using lambda
        students.forEach((id, name) -&amp;gt; System.out.println(id + " -&amp;gt; " + name));
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See you All...&lt;br&gt;
we will meet in Another java8...&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>java</category>
      <category>java8</category>
      <category>lamdaexpression</category>
    </item>
  </channel>
</rss>
