Trending December 2023 # Learn The Working Of The Jmeter Tool # Suggested January 2024 # Top 19 Popular

You are reading the article Learn The Working Of The Jmeter Tool updated in December 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 Learn The Working Of The Jmeter Tool

Introduction to JMeter Tool

Performance testing is important in the application and software development life cycle. For example, if many users use websites, APIs, or applications, they should plan how to manage peak traffic over extended periods. There are many tools available in the market to perform load testing. The popular tool is Apache JMeter, which performs a load test on software and web services like REST and SOAP. This article can briefly examine JMeter, its working, configuration, and other features.

Start Your Free Software Development Course

JMeter Tool

JMeter is a popular tool available as open-source and based on Java. It is a performance testing tool that executes protocol-oriented load tests again different software and web services, API, web applications, SOAP, REST, and other web services. Despite being introduced earlier, JMeter remains a powerful tool among other load testing and performance solution tools due to its reliable features.

In simple, JMeter operates by aping visitors to the service or application, enabling the user to create and transfer HTTP requests to the server. Then the statistical data is displayed by collecting the server response data in tables, charts, and reports. From the generated reports, the user can analyze the application’s behavior, perform bottlenecks, and tweak the website to enhance its efficacy or performance; sometimes, the application improves by offering a few productive insights.

It is mandatory to see that JMeter is not a web browser; it functions at a protocol level and can’t support all the changes performed by the user, like rendering JavaScript. Apart from this, JMeter offers temporary solutions for these issues by providing configuration elements like cookie manager, header manager, and cache manager, which support JMeter’s behavior and function as an actual browser.

JMeter is a desktop application based on Java, so to begin this, there are a few perquisites where it should be configured to initiate the performance test. Consider if the user has the latest Java version installed, which should support the minimum system requirements to use JMeter. Compared to other software as a service load testing tool, it consumes additional resources and time.

JMeter is the most common tool by developers in software development, where their team is comfortable executing the load performance tests. JMeter has gained endurance in the market due to its strong community support, extensive documentation, and wide range of best practices available. In addition, it is cost-effective and can be implemented in an enterprise requiring no or minimal resources to get started.

JMeter is free to use and enables the developers to use the source code for development, testing, and training purposes.

JMeter has a friendly graphical user interface that beginners find easy to use and doesn’t require extra time to understand the tool. It has a simple and direct interface.

JMeter is platform-dependent, based on Java, and can be executed on multiple platforms.

The complete multithreading framework allows the JMeter to simultaneously sample varied functions by a distinct thread group. As a result, it increases the concurrency even in multiple thread groups.

It helps to visualize the output result. The test result can be viewed in tables, trees, charts, and log files.

JMeter installation is easy; the user can copy and execute the *bat file into the host machine.

JMeter is highly extensible as it enables the user to compose his test. In addition, it supports plugins to make effective visualization to extend the testing.

JMeter supports multiple protocols, which support testing on web applications and compute performance tests on database servers. JMeter supports all the basic protocols like JDBC, HTTP, JMS, SOAP, LDAP, FTP, and REST.

The record and playback option is one of the remarkable features of JMeter, where the user can record the activities on the browser and produce them on the website using JMeter. Additionally, JMeter allows for seamless integration of testing and scripting capabilities with Selenium and Beanshell, enabling automated testing functionalities.

Working on JMeter Tool

The working of JMeter is simple, and it follows only a few steps to execute the load testing on applications. First, the JMeter makes multiple users send requests to the target server, extracting the performance result from the target server.

JMeter creates multiple requests to the target server and waits for feedback.

Once the server responds to JMeter, it stores and processes all the responses.

The system computes and collects the responses and generates statistical information or a report.

Then the generated report is fed again as a request to the target server.

You can obtain the analytical report in charts, graphs, tables, or trees.


As the rise of software as a service-based tool becomes predominant and rapid technological changes are consistent, the use of JMeter has never faded. JMeter provides the best tool for load testing solutions, and it comes as a package with all the cloud-based solutions with all the support, benefits, and features and is used as a monthly scheme.

Recommended Articles

We hope that this EDUCBA information on “JMeter Tool” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

You're reading Learn The Working Of The Jmeter Tool

Learn The Examples Of Sql Datediff()

Introduction to SQL Datediff()

In SQL server suppose we have dates in our data and we want to know the difference between those dates then we can use the DATEDIFF function to know the difference between those dates in days, months, or years. So this function returns an integer as output and to understand more about this function lets know it’s syntax first.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Syntax of Datediff() in SQL DATEDIFF (interval, startdate, enddate)

1. Interval – This is also called datepart and it is provided as a string to this function. This argument can be anything that represents a time interval like a month, week, day, year. We can also specify the quarter of the year.

year, yyyy, yy = Year SELECT DATEDIFF(year, '2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); quarter, qq, q = Quarter SELECT DATEDIFF(quarter,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); month, mm, m = month SELECT DATEDIFF(month, '2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); dayofyear = Day of the year SELECT DATEDIFF(dayofyear,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); day, dy, y = Da SELECT DATEDIFF(day,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); week, ww, wk = Week SELECT DATEDIFF(week,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); hour, hh = hour SELECT DATEDIFF(hour,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); minute, mi, n = Minute SELECT DATEDIFF(minute,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); second, ss, s = Second SELECT DATEDIFF(second,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); millisecond, ms = Millisecond SELECT DATEDIFF(millisecond,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000'); microsecond, mcs = Microsecond SELECT DATEDIFF(microsecond,'2010-12-31 23:59:59.9999999', '2011-01-01 00:00:00.0000000');

2. startdate, enddate – These are the actual dates to get the difference between. This is a mandatory parameter.

This function works in the SQL server starting from the 2008 version, Azure SQL Data Warehouse, Azure SQL Database, Parallel Data Warehouse.

Return Value

The return value is an int and is expressed by the datepart or the interval boundary which is the difference between the start and end date.

If the range of the return value for int is out of[-2,147,483,648 to +2,147,483,647], DATEDIFF function returns an error. The max difference between the start and end date is 24 days, 20 hours, 31 minutes, and 23.647 seconds for the millisecond. The max difference is 68 years, 19 days, 3 hours, 14 minutes, and 7 seconds for the second.

If the start and end date have a date with different data type then DATEDIFF will set 0 the missing parts of the other date which has lower precision

The above queries have the same start and end values. These are adjacent dates and the difference between them is a hundred nanoseconds (.0000001 second). The start and end dates cross one calendar and the result of each query is 1.


Here are the examples mention below

Example #1 – Calculating Age select ID,emp_name,emp_dateOfBirth from Employee

We have the above table Employee which consists of the date of birth and from this, we will calculate the age in terms of a year, month, and days in 2 steps

Step 1: Creating a function

CREATE FUNCTION fnEmpComputeAge(@EmpDOB DATETIME) RETURNS NVARCHAR(50) AS BEGIN DECLARE @AgeTempdate DATETIME, @AgeYears INT, @AgeMonths INT, @AgeDays INT SELECT @AgeTempdate= @EmpDOB SELECT @AgeTempdate=DATEADD(YEAR, @AgeYears, @AgeTempdate) SELECT @AgeTempdate=DATEADD(MONTH, @AgeMonths, @AgeTempdate) SELECT @AgeDays=DATEDIFF(DAY, @AgeTempdate,GETDATE()) DECLARE @EmpAge NVARCHAR(50) SET @EmpAge=Cast(@AgeYears AS NVARCHAR(4))+' AgeYears '+Cast(@AgeMonths AS NVARCHAR(2))+' AgeMonths '+Cast(@AgeDays AS NVARCHAR(2))+' AgeDays Old' RETURN @EmpAge End

In the above example, we have created a SQL Function to calculate the age of the employee from the DOB so the function takes @EmpDOBas a parameter and returns NVARCHAR(50). We will see this in action when we run this function. In step, we have created this function.

Then we add the calculated years in the @AgeTempdate using the DATEADD function.

Similarly, we calculated the month and added in @AgeTempdate, and then it is used to calculate days. Next, we declared @EmpAge and set it to the concatenation of the final output. Since the calculation result is in int we used Cast function to convert it into nvarchar.

Step 2: Using the function in the query

select ID,emp_name,emp_dateOfBirth,dbo.fnEmpComputeAge(emp_dateOfBirth) as EmpAge from Employee

The result is as follows:

As we can see we have used dbo.fnEmpComputeAge function and passed emp_dateOfBirth to calculate EmpAge and the result is as above.

Example #2 – Using scalar functions and subqueries for start and end date SELECT DATEDIFF(day, (SELECT MIN([ShipDate])FROM Sales.SalesOrderHeader), (SELECT MAX([ShipDate])FROM Sales.SalesOrderHeader)) as ShippingDateDiff;

The result is as follows:

In this example, we have calculated the shipping date difference using scalar functions and scalar subqueries for min and max.

Example #3 – Using ranking functions for the start date argument SELECT FirstName as first_name,LastName as last_name, DATEDIFF(day,ROW_NUMBER() OVER (ORDER BY DepartmentName),SYSDATETIME()) AS row_number FROM dbo.DimEmployee;

The result is as follows:

In this function, we have used ROW_NUMBER() ranking function as the start date argument.

Example #4 – Using an aggregate window function for the start date argument SELECT FirstName as first_name,LastName as last_name,DepartmentName as department_name, DATEDIFF(year,MAX(HireDate) OVER (PARTITION BY DepartmentName),SYSDATETIME()) AS HireInterval FROM dbo.DimEmployee


Hopefully, now you know what DATEDIFF() is in the SQL server and how it is used to calculate results the difference between date according to datepart.

Recommended Articles

We hope that this EDUCBA information on “SQL DATEDIFF()” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

Learn The Various Types Of Microcomputers

Introduction to Microcomputer Types

Web development, programming languages, Software testing & others

List of Microcomputer types

There are different Microcomputer types given below.

Desktop Computer





1. Desktop Microcomputer 2. Microcomputer Laptop

A laptop, also known as a “Notebook,” is a computer that looks like a sleek briefcase. They can also handle more sophisticated tasks, such as a desktop computer, and they can run on their own in-built battery and a wall socket. Since different small-size components, including a keyboard, LCD monitor, touchpad, and other internal parts, are incorporated into these microcomputers, they are more costly than desktop computers (CPU, Motherboard, Hard disk, etc.). However, its greatest benefit is its portability.

3. Tablets and Smartphones


Tablet microcomputers are compact mobile computers with touch screen displays that are smaller than laptop computers but larger than smartphones. On the LCD panel, users can perform both input and output operations. In addition, they can access the internet through Wi-Fi and other cellular networks. Users can experience issues due to a lack of a keyboard, but they may use an external keyboard if more is needed. Tablets such as Apple’s iPad, Microsoft’s Surface, and Amazon’s Kindle Fire are commercially available.


PDA is short for “Personal Digital Assistant,” and it is a portable device that is equivalent to a tablet, palmtop, or smartphone in terms of portability and scale. It has a small LCD screen for both input and output functions.  a PDA can communicate with other computers such as desktops, laptops, and other devices Via infrared (IR), LAN cable, Bluetooth, Wi-Fi, radio waves, and wireless beams. PDAs are mostly used to keep track of to-do lists, appointment schedules, address books, and to take notes.

4. Palmtop microcomputer

The term “pocket computer” refers to a palmtop microcomputer. It is a smaller computer than a PDA, and it uses less power as a result of its compact scale. It is also a very lightweight laptop. Instead of using a keyboard, palmtop computers use a stylus pen stick to enter data. Palmtops don’t usually have disk drives because of their limited size, so they rely on PCMCIA slots to allow disk drives, multiple modems, memory management, and another terminal. Palmtop computers and other portable computers usually run Windows CE operating systems.

Workstation Microcomputers

Workstation microcomputers, also known as efficient one-side computers, are multiprocessor computers with several CPUs. Typically, this microcomputer is programmed by a single user to run specific programs that need more power than a standard PC.

The server microcomputer looks like a computer, but it has a number of powerful features that enable it to render data to another terminal over a variety of networks, including local area networks (LANs) and wide-area networks (WANs) (WAN). Any type of server is programmed to accomplish a particular task, such as running the Apache HTTP server to manage all websites on the internet and the Mail server to send and receive emails.

Mini Tower Microcomputer

The mini-tower microcomputer was created in the shape of a small tower. Due to its small scale, it can be mounted on the table with less space than other desktop microcomputers. In addition, different buses may be used to link input/output devices to it.

Full Tower Microcomputer

Recommended Articles

This is a guide to Microcomputer types. Here we discuss the various types of microcomputers in detail with their specifications and features. You may also look at the following articles to learn more –

Learn Working Of Json In Swift With Examples

Introduction to Swift JSON

Swift JSON is used for communication of the IOS web application with the server by returning a series of formatted data or information. This formatted data organized in a proper hierarchical manner is called Swift JSON. Foundation framework that includes a class called JSONSerialization is exclusively used for converting any JSON involved within the web application into Swift data types like array, number, bool, String, and Dictionary. It is very difficult to predict the actual structure or the order in which values of JSON-based web applications will receive as part of returned data.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

There is no proper syntax for any Swift JSON it can be any resource file containing the data in an ordered manner as represented below but then indentation does matter while validating any JSON data as improper JSON input might vary and can behave differently while parsing and traversing as well.

{ "title": "some_data", "url": "any_url_can_be_included", "category": "Category_for_swift_language", "views": 25648 } How JSON works in Swift?

JSON parsing or manipulation with JSON in any programming language is a common functionality when any web application tries to communicate with the other server.

Any web application dealing with JSON data tries to decode the JSON data in an ordered manner. Swift JSON parsing is very important for any IOS developer as they will most often get acquainted with these kinds of data.

Decoding modules in swift are quite flexible and are very easy to understand without any indulgence of external API.

There are times when swift JSON containing JSONSerialization class method returns a value of any type and throws error in case the data cannot get parsed easily then a proper validation with error elicitation will be given to the user for identification of the actual exception.

Although the JSON data will get validated still there will be times when JSON may contain a single value, a response from a web application can encode an object or array as any top-level object for manipulation.

All the data types related to swift get used as per requirement and any optional value can be considered for it.

There is quite a need to create Model objects from the Model-view-controller design pattern that are often used to convert json data to objects which are specific to the application’s domain in a model view.

If the applications are related to one or more web services do not return a single, or consistent model for the representation of a model object, considering implementation of several initializers to handle all the possible representations.

JSON initializer helps a lot when it comes to extracting and getting the detailed implementation with errors and exceptions. Error Handling with error protocols helps in deserialization with the fail for protocol.

Many times, it happens that the application returns multiple endpoints for any resource that returns a single JSON response following any particular protocol.

A search endpoint may return zero or more endpoints then in that case the requested query may contain more or other metadata while presenting for the endpoint.

JSON parser plays a pivotal role in parsing as it helps in making the entire JSON data organized in a properly visualized format which gives an impression that the data can be organized in a proper manner.

Swift is the programming language that allows programmers to use and make the data ordered and visualized in a very easy and effective manner by giving an idea of proper idealization and organization for operations and manipulations.

Examples of Swift JSON

Here are the following examples mentioned below.

Example #1

This program demonstrates the JSON data where the input feed is represented as follows and the output feed after execution of the JSON parsing comes out to be shown as output. But it makes the Sample usage feed with the codeable mapping.


{ "title": "Usage of the optional Swift language.", "version": "4.0", "category": "Swift_version", "views": 25642 }


Example #2

This program demonstrates the JSON data where the input feed is represented with the same input as example 1 but with the mere difference of the fact that the JSON decoder will make use of the Object mapper for conversion of JSON String to model. This is shown in the output as shown:


{ "title": "Usage of the optional Swift language.", "version": "4.0", "category": "Swift_version", "views": 25642 }


Example #3

This program demonstrates the JSON data where the input feed is represented with the same input as example 1 but with the more difference of the fact that the JSON decoder will make use of the dictionary mapper for conversion of JSON String to model. This is shown in the output as shown:

{ "title": "Usage of the optional Swift language.", "version": "4.0", "category": "Swift_version", "views": 25642 }


Example #4

This program demonstrates the custom mapping for each defined key with the mapping of a blog and key and value pairs with the JSON and making the key encoding as the main conversion of the JSON to a blog.


{ "title": "Sat_Sun_Week:end_Comboff", "version": "swift_version_4.0", "visitors_way": 258965, "posts_for_members": 62542 }


Example #5

This program demonstrates the custom mapping for each defined key with the mapping of a blog and key and value pairs with the JSON and making the Object mapper in use for representation as shown in the output.

{ "title": "Sat_Sun_Week:end_Comboff", "version": "swift_version_4.0", "visitors_way": 258965, "posts_for_members": 62542 }


Example #6

This program demonstrates the custom mapping for each defined key with the mapping of a blog, key and value pairs with the JSON and making the Dictionary mapper in use for representation as shown in the output.


{ "title": "Sat_Sun_Week:end_Comboff", "version": "swift_version_4.0", "visitors_way": 258965, "posts_for_members": 62542 }



Swift JSON is the proper way of validating and making the entire data set and information organized in a visualized manner for the programmers. The successful communication between any web application and server helps a lot to analyze the entire application for product analysis and division of information uniformly among all applications efficiently.

Recommended Articles

This is a guide to Swift JSON. Here we discuss the introduction, syntax, and working of Swift JSON along with examples and code implementation. You may also have a look at the following articles to learn more –

Learn The Examples Of Truncate Table Statement

Introduction to SQL TRUNCATE()

TRUNCATE in standard query language (SQL) is a data definition language (DDL) statement used to delete complete data from a database table without deleting it. It frees up space or empties space in the table. However, we should note that TRUNCATE TABLE statements might need to be roll backable in many SQL databases. Also, being a DDL statement, the TRUNCATE table statement does not require a commit at each step; it automatically fires a commit at the end of the execution of the statement. Hence, we should be careful while using it.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Syntax and Parameters

The basic syntax for using a SQL TRUNCATE TABLE statement is as follows :

TRUNCATE TABLE table_name;

Table_name: It is the name of the table whose records or rows you want to delete permanently.

How does the TRUNCATE TABLE statement work in SQL?

TRUNCATE TABLE statement in SQL works by zeroing out a file in the database, i.e., after running a TRUNCATE statement on an existing table, the table becomes empty and hence does not hold any row records. It resets the table to zero entries.

However, its structure, columns, indexes, constraints, relationships, views, etc., are preserved after truncating the table. The entire operation is like erasing data from the table but keeping the table intact.

TRUNCATE in Data Definition Language (DDL) is equivalent to DELETE in Data Manipulation Language (DML). The only difference is that the latter can be rolled back, but the first cannot. However, TRUNCATE is faster than DELETE because it usually bypasses the transaction system. It is not logged (it can vary across SQL databases) and does not follow predicates and hence seems to be faster than the DELETE operation. DELETE is a safer and slower operation.

Examples of SQL TRUNCATE()

Here are a few examples to explain the TRUNCATE TABLE statement in great detail.

Example #1

Simple SQL query to illustrate the function of the TRUNCATE TABLE statement.

To understand the SQL TRUNCATE TABLE, let us consider a “customers” table. The data in the table looks like this.


SELECT * FROM public.customers


Next, let us run the TRUNCATE TABLE statement on the customer’s table to remove all its records. We can do so using the following SQL query.




We can see in the figure below that the TRUNCATE TABLE statement has removed all the records in the customer’s table. However, all the columns, relationships, indexes, and table structures have been kept safe.


SELECT * FROM customers;


Example #2

For this, let us consider two tables, “customer_details” and “students”. The table structure and the data in them look something like this. Records in the “Customer_details” table are as follows:


SELECT * FROM public.customers_details


Records in the “Students” table are as follows:

SELECT * FROM public.students


Next, we will run the TRUNCATE TABLE on the customer_details table and DROP TABLE on the student’s table, and then we will check the difference.


TRUNCATE TABLE customer_details;




We can observe from the images above that the DROP TABLE statement is faster than the TRUNCATE TABLE statement in SQL.

Now let us check what happened to the two tables after truncating and dropping, respectively.


SELECT * FROM customer_details;



SELECT * FROM students;


From the above two images, we can observe that in the TRUNCATE statement, the table structure is preserved; only the data/records in the table have been removed. Whereas in the case of the DROP TABLE statement, the entire table has been removed from the database.


TRUNCATE TABLE in SQL is a Data Definition Language (DDL) statement that empties an existing table by removing all the records while preserving table columns, privileges, indexes, views, constraints, relationships, etc. It is equivalent to but faster than the DELETE statement in SQL. However, unlike DELETE, it cannot be rolled back.

Recommended Articles

We hope that this EDUCBA information on “SQL TRUNCATE()” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

Learn The Different Examples Of Plsql Pivot

Introduction to PLSQL pivot

PL/SQL provides the different types of functionality to the user; the pivot is the one type of functionality that is provided by the PL/SQL. Basically, we call it a pivot clause. By using pivot clauses, we cross table query as per requirement; in another way, we can combine, or we can aggregate our result from rows into the columns as per our requirement. Basically, the pivot clause introduced in Oracle 11g and the pivot returns more than one column after the execution. By using pivot clauses, we can combine the difference into a single result and generate the required output.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Syntax select * from (select colm name 1, colm name name N from specified table where conditional expression) PIVOT


First, we use the select clause to retrieve the records from the specified table. Inside the select, we write the subquery with a column name, and here we specify where clause with conditional expression.

Specified aggregate function name: it is used to specify the aggregate function name that we can write any function name such as SUM, MIN, MAX, etc.

IN (specified expression 1, specified expression 2,…..specified expression N): It is used to hold the list of column name 2 that values to pivot into the cross table.

Specified subquery: Basically, it is used instead of list values, and the output of the subquery would be utilized to calculate the values for column 2 in the cross-tabulation query output, which would then be translated to headings in this syntax.

How does pivot work in PL/SQL?

Now let’s see how pivot clauses work in PL/SQL as follows.

Let’s see the different ways to implement the pivot clause as follows.

Specify the Group Columns:

Any columns not stated in the FOR clause are utilized as a part of the Oracle PIVOT GROUP BY when employing the PIVOT keyword. The only column in the previous example was the location column, which was fine.

We can also use the Where clause with pivot clause:

The results of our searches above provide a pivoted summary of all data. A few fields are used to aggregate all of the entries, and the SUM of the selling amount is displayed.

What if you want to limit it to just a few rows?

Like a regular SELECT query, you may use a WHERE clause. Then we will get the error due to incorrect syntax, so we need to write the correct syntax that means the PIVOT clause must appear after the WHERE clause; this is the case.

Now let’s see how we can use Aliasing in the pivot column:

The column headings will be shown as the table’s column name in the queries we’ve looked at so far. What if you want to call them something else? A column alias can be specified using the PIVOT keyword. Both the pivot clause and the pivot in a clause can be used for this.

Now let’s see how we can perform the multiple aggregations in pivot:

We can make the group of multiple columns:

This is another way to implement the multiple columns into the pivot statement to group by multiple columns as per our requirement.

We can implement pivot with XML as follows:

You may display your findings in an XML format using the PIVOT keyword. It’s as simple as following the PIVOT keyword with the XML keyword.

Examples of PLSQL pivot

Now let’s see the different examples of pivot clauses in PL/SQL for better understanding as follows.

First, we need to create the table by using the following create table statement as follows.

create table stud(roll_no integer not null, name varchar2(50), dept_id integer not null, primary key(roll_no));


By using create table statement, we created a new table name as a stud with different attributes such as roll_no, name, and dept_id with different data types, and in this example, the primary key is roll_no. The final output of the above statement we illustrated by using the following screenshot as follows.

insert into stud(roll_no, name, dept_id) values(1,'Jenny',10); insert into stud(roll_no, name, dept_id) values(2,'Jenny',10); insert into stud(roll_no, name, dept_id) values(3,'Jenny',20); insert into stud(roll_no, name, dept_id) values(5,'Sameer',20); insert into stud(roll_no, name, dept_id) values(6,'Sameer',10); insert into stud(roll_no, name, dept_id) values(7,'Sameer',20);


In the stud table, we inserted a total of 6 records by using the above statement. The final output of the above statement we illustrated by using the following screenshot as follows.

If records are not in order, then we can use order by clause to make the records in order. In this example, all records we order by roll_no, as shown in the above screenshot.

Now implement the pivot clause that means write the cross table subquery as follows.

select * from (select name, dept_id from stud) pivot (count(dept_id) for dept_id IN (10, 20, 30)) order by name;


In the above example, we write the two different queries that we call subquery and merge by using the pivot clause. Now let’s see how it works. In the above example, we first decide which field we want to add in the pivot clause; here, we add name and dept_no. After that, we need to specify the column in any order that we want. The next part of the query, it contains the aggregate function and pivot value that we want, as shown in the above statement. The final output of the above statement we illustrated by using the following screenshot as follows.

Conclusion – PLSQL pivot

We hope from this article you learn PL/SQL pivot. From the above article, we have learned the basic syntax of the pivot, and we also see different examples of the pivot. From this article, we learned how and when we use PL/SQL pivot.

Recommended Articles

We hope that this EDUCBA information on “PLSQL pivot” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

Update the detailed information about Learn The Working Of The Jmeter Tool on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!