In one of the recent programming job interviews, one of my readers was asked the question, how do you join two tables which are not related to each other? i.e. they don't have any common column? is it possible in SQL? My reader got confused because he only knows about INNER join and OUTER join which require a key column like dept_id which is the primary key in one table like Department and foreign key in another table like Employee. He couldn't answer the question, though he did tell them about you can select data from multiple tables by typing multiple table names in from clause using a comma.
Blog to learn about SQL, database, Oracle, SQL Server, MySQL, PostgreSQL concepts and much more.
Thursday, February 20, 2025
Wednesday, February 19, 2025
Difference between Candidate Key vs Primary Key in Database/SQL
Tuesday, February 18, 2025
What is Difference between Clustered vs Non-Clustered Indexes in a table? [SQL Interview Question]
Thursday, February 13, 2025
Top 10 SQL Server Functions Programmer Should Learn (with Examples)
Hey there! SQL Server functions are like magic spells in the enchanted forest of databases. They can transform your data and make it dance to your tune. In this article, I'm going to share my top 10 SQL Server functions that every programmer should have in their toolkit.
How to use rank, row_number, and dense_rank in SQL? Example
Hey folks, ever found yourself at a data party, trying to figure out the pecking order? Well, I've been there too, and SQL has some nifty moves to help you out. Today, I'm going to show you how to use RANK, ROW_NUMBER, and DENSE_RANK in SQL to sort and analyze your data like a pro.
10 SQL commands every Programmer should learn
Hey there! If you're diving into the world of databases, SQL (Structured Query Language) is your golden ticket to handle and manipulate data. It's like learning the secret handshake to the programming club. In this article, I'll share the top 10 SQL commands that every programmer should have in their toolbox.
Saturday, February 8, 2025
Difference between CHAR and VARCHAR in SQL
Hey, folks! Today, we're diving into the fascinating world of SQL data types, specifically, the showdown between CHAR and VARCHAR. It's a bit like choosing between a sturdy old book (CHAR) and a flexible e-reader (VARCHAR). So, grab your virtual coffee, and let's unravel the mystery behind these two SQL heavyweights.
10 Ways to use GROUP BY command in SQL with Examples
Hey there! If you've ever waded into the wonderful world of SQL, you'll know it's a bit like orchestrating a symphony of data. And one of the most beautiful instruments in this orchestra is the GROUP BY command. So, let's take a stroll down memory lane (or should I say data lane?) as I share the ten fantastic ways I fell in love with GROUP BY.
Friday, January 24, 2025
10 ways to use SELECT command in SQL with Examples
Hey there! If you've ever danced with databases, you're no stranger to the SELECT command in SQL. It's like the DJ at a data party, spinning records and giving you the tunes you need. But did you know there are more ways to groove with SELECT than you might think? Let's dive into the top 10 ways to make SELECT your SQL superstar.
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, January 23, 2025
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.
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.
Monday, January 20, 2025
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!
How to find top 10 records from a table in Oracle, MySQL, and SQL Server? Examples
Monday, January 13, 2025
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.
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.