Skip to content

Muhammet Dursun Şahin

tech,psychology

Menu
  • CX
  • UX/UI
  • Data
  • Genel
Menu

SQL Tutorial: Managing Employee Data

Posted on 16 January 2025

In this blog post, we will explore some basic SQL operations to manage and analyze employee data effectively. We will use the following three common operations as examples:

  1. Retrieving top records with specific columns.
  2. Selecting specific columns from a table.
  3. Calculating the average of a numeric column.

Retrieving Top Records with Specific Columns

To display the top 1000 records from the EmployeeDemographics table, along with specific columns like EmployeeID, FirstName, LastName, Age, and Gender, you can use the SELECT statement:

SELECT TOP (1000) [EmployeeID],
                  [FirstName],
                  [LastName],
                  [Age],
                  [Gender]
FROM [SQL Tutorial].[dbo].[EmployeeDemographics];

This query fetches the first 1000 records from the table, which can be useful when working with large datasets.

Selecting Specific Columns from a Table

To retrieve only the FirstName and LastName columns from the EmployeeDemographics table, use the following query:

SELECT FirstName, LastName
FROM [SQL Tutorial].[dbo].[EmployeeDemographics];

This query helps focus on the key identifying information of employees without overloading the output with unnecessary columns.

Calculating the Average of a Numeric Column

To calculate the average salary of employees, you can use the AVG function on the Salary column from the EmployeeSalary table:

SELECT AVG(Salary)
FROM [SQL Tutorial].[dbo].[EmployeeSalary];

The result will give you the average salary, which is crucial for analysis like budgeting or determining competitive pay rates.

Example Output

Query: Selecting FirstName and LastName

The result might look like this:

FirstNameLastName
MuhammetSahin
DwightSchrute
AngelaMartin
TobyFlenderson
MichaelScott

Query: Calculating Average Salary

For the salary query, the output might be:

(No column name)
48555

This indicates that the average salary is 48,555.

Conclusion

By mastering these basic SQL queries, you can efficiently retrieve, filter, and analyze employee data for meaningful insights. SQL remains a powerful tool for database management and analysis, and practicing these queries will strengthen your foundational skills. Happy querying!

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook

Like this:

Like Loading…

Related

Leave a Reply Cancel reply

Recent Posts

  • Getir Ödeme Sistemleri Vaka Çalışması | 6 Aşamalı İş Analizi
  • Arzum Okka: Müşteri Geri Bildirimlerine Dayalı Ürün Analizi
  • Apple Health Step Tracking Feature: A Product Case Study
  • User Registration & Onboarding Activity Diagram
  • NexaCRM

CATEGORY

Recent Posts

  • Getir Ödeme Sistemleri Vaka Çalışması | 6 Aşamalı İş Analizi 24 July 2026

How to Improve NPS Score: Strategies That Actually Work

©2026 Muhammet Dursun Şahin | Design: Newspaperly WordPress Theme
Loading Comments...
%d