<?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: Morteza Mousavi</title>
    <description>The latest articles on DEV Community by Morteza Mousavi (@morteza_mousavi_6e0996798).</description>
    <link>https://dev.to/morteza_mousavi_6e0996798</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2833107%2F467b09af-921f-4f47-9285-c736f121a3ec.jpeg</url>
      <title>DEV Community: Morteza Mousavi</title>
      <link>https://dev.to/morteza_mousavi_6e0996798</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/morteza_mousavi_6e0996798"/>
    <language>en</language>
    <item>
      <title>Aggregate Functions in SQL</title>
      <dc:creator>Morteza Mousavi</dc:creator>
      <pubDate>Sat, 15 Feb 2025 06:02:16 +0000</pubDate>
      <link>https://dev.to/morteza_mousavi_6e0996798/aggregate-functions-in-sql-304c</link>
      <guid>https://dev.to/morteza_mousavi_6e0996798/aggregate-functions-in-sql-304c</guid>
      <description>&lt;p&gt;Often, when querying in SQL, it is necessary to obtain the sum of a series of numbers, such as the total salary. In SQL, specific functions have been defined for this operation, known as Aggregate Functions or Grouping Functions.&lt;/p&gt;

&lt;p&gt;Aggregate Functions are used for grouping when working with numerical and statistical data, allowing us to obtain results after performing a series of basic or advanced mathematical calculations.&lt;/p&gt;

&lt;p&gt;Aggregate Functions are predefined functions that, when configured during a database query according to our needs, perform the desired operations and return the results.&lt;/p&gt;

&lt;p&gt;Functions like Sum and Count are examples of Aggregate Functions, and their main characteristic is that they return a single value based on specific calculations on the values of a column.&lt;/p&gt;

&lt;p&gt;Next, we will examine these functions.&lt;br&gt;
Min Function&lt;/p&gt;

&lt;p&gt;This function is used to obtain the minimum value from similar values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT MIN(grade)
FROM StudentGrade;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, we use this function to find the lowest score of students in the student grades table.&lt;br&gt;
Max Function&lt;/p&gt;

&lt;p&gt;This function is exactly the opposite of the Min function; it is used to find the maximum value among similar values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT MAX(salary)
FROM Personnel
WHERE Age &amp;lt; 35;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, it finds and displays the highest salary among personnel who are under 35 years old.&lt;br&gt;
Sum Function&lt;/p&gt;

&lt;p&gt;This function is used to obtain the sum of numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT SUM(Salary)
FROM Personnel;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, this function is used to sum all the salaries of the personnel in the personnel table.&lt;br&gt;
Count Function&lt;/p&gt;

&lt;p&gt;As the name of this function indicates, it is used to obtain the number of items.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT COUNT(Id)
FROM Personnel;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Count function is used to find the number of personnel.&lt;br&gt;
Avg Function&lt;/p&gt;

&lt;p&gt;The AVG function is actually an abbreviation for “average.” Using the AVG function, we can calculate and display the average of the desired values from grouped columns.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT AVG(Salary)
FROM Personnel;

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

&lt;/div&gt;



&lt;p&gt;In this example, the &lt;a href="https://minisample.ir/BlogDetails/AggregateSql" rel="noopener noreferrer"&gt;AVG&lt;/a&gt; function is used to calculate the average salary of the personnel.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>sqlserver</category>
      <category>aggregatefunction</category>
      <category>database</category>
    </item>
    <item>
      <title>Building a Docker image from a JavaScript file</title>
      <dc:creator>Morteza Mousavi</dc:creator>
      <pubDate>Sat, 08 Feb 2025 06:55:28 +0000</pubDate>
      <link>https://dev.to/morteza_mousavi_6e0996798/building-a-docker-image-from-a-javascript-file-40d3</link>
      <guid>https://dev.to/morteza_mousavi_6e0996798/building-a-docker-image-from-a-javascript-file-40d3</guid>
      <description>&lt;p&gt;One of the simplest and most basic exercises in containerizing and getting familiar with Docker files is working with a simple JavaScript file. In this example, we will containerize a simple JavaScript file that doesn’t perform any specific function, or to put it more simply, we will create an image in Docker from this file.&lt;/p&gt;

&lt;p&gt;To get started, we will create a JavaScript file that contains, for example, console.log('hello');.&lt;/p&gt;

&lt;p&gt;Next, alongside this file, we will create a file named DockerFile. Make sure that the file name is exactly this, and then we will open the file to start our work.&lt;/p&gt;

&lt;p&gt;First of all, we need Node.js to run JavaScript files, so we will download the Node.js image from Docker Hub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`FROM node:alpine`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the FROM command, we download the Alpine version, which is a lightweight version of Node.js.&lt;/p&gt;

&lt;p&gt;Now we need to create a directory in the image we are building to store the files and execute commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WORKDIR ./jsdir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the WORKDIR command, you can create a directory with any name you want.&lt;/p&gt;

&lt;p&gt;Now it’s time to copy the files into this directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`COPY hello.js .`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have copied the files, we move on to the step of executing the hello.js file that we created:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`CMD node hello.js`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if you build and run the image using the following command, you will be able to see the printed output of “Hello”:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;`docker build -t hello .`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>programming</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
