Monday, December 12, 2022

How to store and Query Hierarchical Data in Database using SQL? Example Tutorial

What methods do you use to detect hierarchical data and query it? We're about to get answers to two popular SQL queries. When working with SQL and relational databases, querying hierarchical data is a typical occurrence. It's not that hierarchical data is mysterious or uncommon; on the contrary, it's all around us. So, why is hierarchical data so difficult to work within relational databases? The issues arise mostly when converting hierarchical data to relational database concepts.

Thursday, October 13, 2022

Top 30 Database Interview Questions and Answers

 Hello guys, if you are preparing for programming or technical interview then you must prepare for Database and SQL, these two are the most important skill for any programming or software development job be it a Java developer, C++ developer or a web developer. Earlier, I have shared 15 SQL Query Interview Questions and in this article, I am going to share 30 common database interview questions. I am not sharing the answer though as I expect you to already know the answers of these basic Database questions but if you struggle with any questions, ping me on comments section and I might just add the answers as well, depending upon what you guys like. 

Friday, September 2, 2022

How to create and Rollback Transaction in SQL query? Example Tutorial

A transaction in SQL Server is a consecutive gathering of explanations or queries to perform single or numerous undertakings in a data set. Every transaction might have single perused, compose, update, or delete tasks or a blend of this large number of tasks. Every transaction should happen two things in SQL Server:

  • Either all alteration is effective when the transaction is committed.
  • Or on the other hand, all alterations are scattered when the transaction is rollback.

Sunday, August 21, 2022

Difference between DELETE vs DROP vs TRUNCATE in SQL

What the differences are between the commands Delete, Drop, and Truncate has to be one of the most popular queries during SQL interviews. We are here to answer any of your questions regarding this interview question. In this article, we will go over this concept and learn the difference between them in a very practical manner. So, what's the wait? let's start!

Saturday, August 13, 2022

How to find top 10 records from a table in Oracle, MySQL, and SQL Server? Examples

Finding top 10 records is common need for programmers working with tables and database. Be it courses, cars, cricket, players, etc. The list is never-ending. But how do select TOP records from the database? As this is what happens in the back-end. So, if you are also looking for the answer to this question, check out this article and know more. We will see how to select the TOP 10 records from different databases with practical examples.

Sunday, July 31, 2022

How to convert String to Date in SQL Server and T-SQL? Example tutorial

While working with crude information, you may oftentimes confront date values put away as text. Changing these qualities over completely to a date information type is vital since dates might be more significant during examination. In SQL Server, switching a string over completely to date can be accomplished in various methodologies.  In this article, we will cover various techniques to convert String to Date in all databases. 

Sunday, June 12, 2022

10 Example of ALTER Clause in SQL

ALTER clause is one of the DDL commands which allows you to change object structure  in database like  table, stored procedure, trigger, or any other object in the database. By using ALTER command you can add or remove columns in a table, you can add and remove index from a table as well as you can update a stored procedure.  ALTER command is an essential SQL commands for programmers similar to SELECT, UPDATE, and DELETE. If you know how to create a table or index then you should also know how to modify a table or index using ALTER command. In this article, we'll see some common ALTER table examples in SQL to learn this command better and become a better database developer. 

Friday, May 13, 2022

How to use Stored Procedure in SQL or Database? Pros and Cons with Example

Hello folks if you want to learn about Stored Procedures in SQL and how it can help you to create a layer of abstraction around functionality then you have come to the right place.  With the help of many examples, we will learn how to construct stored procedures in SQL Server.

Saturday, May 7, 2022

Difference between UNION and UNION ALL in SQL

Hello guys, if you are wondering how to combine data from multiple tables into one result set in SQL then there are multiple options. Earlier, we have looked at JOIN which allows you to fetch data from multiple table in single query, other option is UNION and UNION ALL which you can use to combine the data from multiple tables. We saved data in SQL tables in the relational database. We may need to choose data from various tables and aggregate the results of all Select statements on occasion. The SQL Union and versus Union All operators in SQL Server are explained in this article. We'll also look at the differences between these two operators, as well as some applications.

Saturday, April 23, 2022

How to use WHERE and HAVING clause in SQL? Example Tutorial

Hello guys, if you want to learn about WHERE and HAVING clause in SQL then you have come to the right place. This blog shall be explaining how to use WHERE and HAVING clauses in SQL. but it won't be fine if we just jump to it. We need a good understanding of what SQL is and what it is used for. SQL stands for structured queried language, as it sounds it is a language or syntax that is used to query the database.

Saturday, March 26, 2022

MySQL vs NoSQL (non relational DB) - Pros and Cons

Hello guys, if you are wondering whether to choose a NoSQL database like MongoDB, Cassandara, or MySQL for your application then you have come to the right place. In an earlier article, MySQL vs PostgreSQL I had shared the pros and cons of choosing MySQL over PostgreSQL for your application, and in this article, I am going to show the benefits and drawbacks of choosing MySQL over NoSQL or vice-versa. 

Monday, March 21, 2022

How to do Pagination in SQL Server? Query Example Tutorial

 What is pagination?

Pagination, often known as paging, is a method of breaking down huge amounts of material into smaller, distinct pages. Pagination is a popular feature of online applications, as evidenced by Google. The primary principle of pagination is that when we search for anything on Google, the results are displayed on a different page.

Saturday, March 19, 2022

Transposing data in SQL - Example Tutorial

What is Transposition?

A transposition is when data is rotated from one row or column to another in order to modify the data layout and make observations from a different perspective. Row to the column, column to column, and bidirectional transposition are examples of basic transposition algorithms. Others, such as dynamic transposition, transposition with inter-row computations, and join-based transposition, are more complicated. All are prevalent in data analytics and so worthy of investigation.

Thursday, March 17, 2022

SQL cross join Example and it's performance

Hello guys, in the past, I gave you a quick overview of SQL JOINS where we learned about different types of JOINS like right, left, inner, and outer join, and in this article, we'll learn about the SQL CROSS JOIN idea in this post, and we'll back up our knowledge with simple examples and illustrations. So, let's start with the basics.

Tuesday, March 15, 2022

Difference between DDL and DML commands in SQL with examples

What are SQL commands?

SQL commands are just that: commands. It's used to send and receive data from the database. It may also be used to carry out particular activities, functions, and data searches.
SQL can build tables, add data to tables, drop tables, change tables, and define permissions for users, among other things.

Saturday, March 12, 2022

MySQL vs PostgreSQL? Pros and Cons

Which database to choose?

When establishing a new project, especially one on the Web, choosing a database management system is frequently an afterthought. Most frameworks include an object-relational mapping (ORM) tool that hides the differences across platforms and makes them all run at the same speed. 

Using the default choice (in most situations, MySQL) is seldom a bad idea, but it's worth thinking about. Don't get caught up in familiarity and comfort — a smart developer must constantly make educated selections based on the many possibilities, their pros, and downsides.

Tuesday, March 8, 2022

What is Virtual columns in MySQL and How to use it? Example Tutorial

 What is a Virtual Column and where is it used?

Virtual/generated columns are a new feature in MySQL 5.7. Because the data in this column is computed based on a specified expression or from other columns, it is called a generated column.

Virtual columns resemble regular table columns in appearance, but their values are generated rather than saved on a disc.

Virtual columns are one of MySQL 5.7's most useful features; they allow you to store a value in a new field that is derived from one or more other fields in the same table.

Friday, March 4, 2022

Top 5 Common Errors and Mistakes in SQL and How to Solve Them

After writing some SQL code, you're ready to query your database. You type in the code, and nothing happens. Instead, you're presented with an error notice. 

Don't give up! SQL, like any other computer language, is prone to coding mistakes. We'll go through a few frequent mistakes individuals make while creating SQL in this tutorial.

Sunday, February 27, 2022

What is Primary key in SQL? How to choose Primary key in table? Example

If you've ever dealt with databases, you've almost certainly come across the term - primary key (PK). And if you're following this series to learn about databases, this piece should help you understand what the PK is all about. Even if you're a database specialist, you could learn something new or improve your skills. So sit back, relax, and let's get started with the PKs.

Wednesday, January 26, 2022

How to concatenate columns in SQL Server? Example Tutorial

Hello guys, welcome to my new blog SQLrevisited. I have long back created this blog to exclusively share SQL and Database articles but never get time to start it until today. This is the first article on this blog and in this post, you will learn how to contact multiple columns in an SQL server. 

Like Java and many other programming languages and databases, you can use the + operator to concatenate multiple columns in SQL Server. You can join as many columns as you want with the + operator but you must remember that concatenating with NULL will produce NULL, which means you can lose the information from other columns if one of them is NULL.