SQL Interview Questions with Answers
1. How to change a table name in SQL?
This is the command to change a table name in SQL:
ALTER TABLE table_name
RENAME TO new_table_name;
We will start off by giving the keywords ALTER TABLE, then we will follow it up by giving the original name of the table, after that, we will give in the keywords RENAME TO and finally, we will give the new table name.
2. How to use LIKE in SQL?
The LIKE operator checks if an attribute value matches a given string pattern. Here is an example of LIKE operator
SELECT * FROM employees WHERE first_name like ‘Steven’;
With this command, we will be able to extract all the records where the first name is like “Steven”.
3. If we drop a table, does it also drop related objects like constraints, indexes, columns, default, views and sorted procedures?
Yes, SQL server drops all related objects, which exists inside a table like constraints, indexes, columns, defaults etc. But dropping a table will not drop views and sorted procedures as they exist outside the table.
4. Explain SQL Constraints.
SQL Constraints are used to specify the rules of data type in a table. They can be specified while creating and altering the table. The following are the constraints in SQL: NOT NULL CHECK DEFAULT UNIQUE PRIMARY KEY FOREIGN KEY
React ❤️ for more
1. How to change a table name in SQL?
This is the command to change a table name in SQL:
ALTER TABLE table_name
RENAME TO new_table_name;
We will start off by giving the keywords ALTER TABLE, then we will follow it up by giving the original name of the table, after that, we will give in the keywords RENAME TO and finally, we will give the new table name.
2. How to use LIKE in SQL?
The LIKE operator checks if an attribute value matches a given string pattern. Here is an example of LIKE operator
SELECT * FROM employees WHERE first_name like ‘Steven’;
With this command, we will be able to extract all the records where the first name is like “Steven”.
3. If we drop a table, does it also drop related objects like constraints, indexes, columns, default, views and sorted procedures?
Yes, SQL server drops all related objects, which exists inside a table like constraints, indexes, columns, defaults etc. But dropping a table will not drop views and sorted procedures as they exist outside the table.
4. Explain SQL Constraints.
SQL Constraints are used to specify the rules of data type in a table. They can be specified while creating and altering the table. The following are the constraints in SQL: NOT NULL CHECK DEFAULT UNIQUE PRIMARY KEY FOREIGN KEY
React ❤️ for more
❤8
💻 𝗙𝗥𝗘𝗘 𝗘𝘅𝗰𝗲𝗹 𝗠𝗮𝘀𝘁𝗲𝗿𝗰𝗹𝗮𝘀𝘀 – 𝗕𝗲𝘆𝗼𝗻𝗱 𝗖𝗼𝗹𝗹𝗲𝗴𝗲 𝗕𝗮𝘀𝗶𝗰𝘀
Still using Excel only for simple tables?
Learn how professionals use Excel for data analysis, insights & reporting.
✔ Real business use cases
✔ Must-know Excel formulas
✔ Data cleaning & analysis
✔ Career guidance
📅 13 March | ⏰ 6 PM
𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗙𝗼𝗿 𝗙𝗥𝗘𝗘👇 :-
https://pdlink.in/4bEDmIw
🚀 Upgrade your Excel skills today!
Still using Excel only for simple tables?
Learn how professionals use Excel for data analysis, insights & reporting.
✔ Real business use cases
✔ Must-know Excel formulas
✔ Data cleaning & analysis
✔ Career guidance
📅 13 March | ⏰ 6 PM
𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗙𝗼𝗿 𝗙𝗥𝗘𝗘👇 :-
https://pdlink.in/4bEDmIw
🚀 Upgrade your Excel skills today!
How to send follow up email to a recruiter 👇👇
(Tap to copy)
Dear [Recruiter’s Name],
I hope this email finds you doing well. I wanted to take a moment to express my sincere gratitude for the time and consideration you have given me throughout the recruitment process for the [position] role at [company].
I understand that you must be extremely busy and receive countless applications, so I wanted to reach out and follow up on the status of my application. If it’s not too much trouble, could you kindly provide me with any updates or feedback you may have?
I want to assure you that I remain genuinely interested in the opportunity to join the team at [company] and I would be honored to discuss my qualifications further. If there are any additional materials or information you require from me, please don’t hesitate to let me know.
Thank you for your time and consideration. I appreciate the effort you put into recruiting and look forward to hearing from you soon.Warmest regards,(Tap to copy)
🤖 𝗔𝗜 + 𝗗𝗮𝘁𝗮 = 𝗧𝗵𝗲 𝗙𝘂𝘁𝘂𝗿𝗲 𝗼𝗳 𝗝𝗼𝗯𝘀
Start your journey in Data Analytics & Data Science with AI Certification and gain skills companies are actively hiring for.
📊 Data Analysis
🐍 Python Programming
🤖 Machine Learning
📈 AI-Driven Insights
🔥 Perfect for College Students ,Freshers & Professionals
1️⃣𝗣𝘆𝘁𝗵𝗼𝗻 :- https://pdlink.in/3OD9jI1
2️⃣𝗗𝗮𝘁𝗮 𝗦𝗰𝗶𝗲𝗻𝗰𝗲 :- https://pdlink.in/4kucM7E
3️⃣𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 :- https://pdlink.in/4ay4wPG
4️⃣𝗕𝘂𝘀𝗶𝗻𝗲𝘀𝘀 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 :- https://pdlink.in/3ZtIZm9
5️⃣𝗔𝗜 & 𝗠𝗮𝗰𝗵𝗶𝗻𝗲 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 :- https://pdlink.in/4rMivIA
Don't Miss This Opportunity . Get Placement Assistance With 5000+ Companies
Start your journey in Data Analytics & Data Science with AI Certification and gain skills companies are actively hiring for.
📊 Data Analysis
🐍 Python Programming
🤖 Machine Learning
📈 AI-Driven Insights
🔥 Perfect for College Students ,Freshers & Professionals
1️⃣𝗣𝘆𝘁𝗵𝗼𝗻 :- https://pdlink.in/3OD9jI1
2️⃣𝗗𝗮𝘁𝗮 𝗦𝗰𝗶𝗲𝗻𝗰𝗲 :- https://pdlink.in/4kucM7E
3️⃣𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 :- https://pdlink.in/4ay4wPG
4️⃣𝗕𝘂𝘀𝗶𝗻𝗲𝘀𝘀 𝗔𝗻𝗮𝗹𝘆𝘁𝗶𝗰𝘀 :- https://pdlink.in/3ZtIZm9
5️⃣𝗔𝗜 & 𝗠𝗮𝗰𝗵𝗶𝗻𝗲 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 :- https://pdlink.in/4rMivIA
Don't Miss This Opportunity . Get Placement Assistance With 5000+ Companies
❤2
✅ Web Development Mock Interview Questions with Answers 💻🎯
1️⃣ Q: What is the difference between HTML and HTML5?
A: HTML5 is the latest version and supports new elements like <audio>, <video>, <canvas>, and improved semantic tags. It also supports local storage and offline capabilities.
2️⃣ Q: What is the difference between == and === in JavaScript?
A: == compares values after type conversion, while === compares both value and type.
Example:
3️⃣ Q: Explain the Box Model in CSS.
A: The CSS Box Model consists of:
- *Content* → The actual text/image
- *Padding* → Space around content
- *Border* → Around the padding
- *Margin* → Space outside the border
4️⃣ Q: What are the different HTTP methods?
A: Common methods:
- *GET* → Retrieve data
- *POST* → Send data
- *PUT* → Update existing data
- *DELETE* → Remove data
5️⃣ Q: What is the difference between null and undefined in JavaScript?
A:
-
-
6️⃣ Q: What is responsive design?
A: It makes web pages look good on all devices (mobile, tablet, desktop) using CSS media queries and flexible layouts.
7️⃣ Q: What is the role of JavaScript in web development?
A: JavaScript adds interactivity to web pages — like dropdowns, sliders, form validation, etc.
8️⃣ Q: What is DOM?
A: The Document Object Model represents the page structure in a tree format, allowing JavaScript to interact with and manipulate HTML/CSS dynamically.
👍 Tap ❤️ for more!
1️⃣ Q: What is the difference between HTML and HTML5?
A: HTML5 is the latest version and supports new elements like <audio>, <video>, <canvas>, and improved semantic tags. It also supports local storage and offline capabilities.
2️⃣ Q: What is the difference between == and === in JavaScript?
A: == compares values after type conversion, while === compares both value and type.
Example:
5 == '5' is true, but 5 === '5' is false.3️⃣ Q: Explain the Box Model in CSS.
A: The CSS Box Model consists of:
- *Content* → The actual text/image
- *Padding* → Space around content
- *Border* → Around the padding
- *Margin* → Space outside the border
4️⃣ Q: What are the different HTTP methods?
A: Common methods:
- *GET* → Retrieve data
- *POST* → Send data
- *PUT* → Update existing data
- *DELETE* → Remove data
5️⃣ Q: What is the difference between null and undefined in JavaScript?
A:
-
null → Assigned value meaning “no value”-
undefined → A variable that has been declared but not assigned a value6️⃣ Q: What is responsive design?
A: It makes web pages look good on all devices (mobile, tablet, desktop) using CSS media queries and flexible layouts.
7️⃣ Q: What is the role of JavaScript in web development?
A: JavaScript adds interactivity to web pages — like dropdowns, sliders, form validation, etc.
8️⃣ Q: What is DOM?
A: The Document Object Model represents the page structure in a tree format, allowing JavaScript to interact with and manipulate HTML/CSS dynamically.
👍 Tap ❤️ for more!
❤5
Best practices for writing SQL queries:
1- Filter Early, Aggregate Late: Apply filtering conditions in the WHERE clause early in the query, and perform aggregations in the HAVING or SELECT clauses as needed.
2- Use table aliases with columns when you are joining multiple tables.
3- Never use select *, always mention list of columns in select clause before deploying the code.
4- Add useful comments wherever you write complex logic. Avoid too many comments.
5- Use joins instead of correlated subqueries when possible for better performance.
6- Create CTEs instead of multiple sub queries, it will make your query easy to read.
7- Join tables using JOIN keywords instead of writing join condition in where clause for better readability.
8- Never use order by in sub queries, It will unnecessary increase runtime. In fact some databases don't even allow you to do that.
9- If you know there are no duplicates in 2 tables, use UNION ALL instead of UNION for better performance.
1- Filter Early, Aggregate Late: Apply filtering conditions in the WHERE clause early in the query, and perform aggregations in the HAVING or SELECT clauses as needed.
2- Use table aliases with columns when you are joining multiple tables.
3- Never use select *, always mention list of columns in select clause before deploying the code.
4- Add useful comments wherever you write complex logic. Avoid too many comments.
5- Use joins instead of correlated subqueries when possible for better performance.
6- Create CTEs instead of multiple sub queries, it will make your query easy to read.
7- Join tables using JOIN keywords instead of writing join condition in where clause for better readability.
8- Never use order by in sub queries, It will unnecessary increase runtime. In fact some databases don't even allow you to do that.
9- If you know there are no duplicates in 2 tables, use UNION ALL instead of UNION for better performance.
❤2
𝗙𝗥𝗘𝗘 𝗢𝗻𝗹𝗶𝗻𝗲 𝗠𝗮𝘀𝘁𝗲𝗿𝗰𝗹𝗮𝘀𝘀 𝗢𝗻 𝗕𝘆 𝗜𝗻𝗱𝘂𝘀𝘁𝗿𝘆 𝗘𝘅𝗽𝗲𝗿𝘁𝘀 😍
Choose the Right Career Path in 2026
Learn → Level Up → Get Hired
🎯 Join this FREE Career Guidance Session & find:
✔ The right tech career for YOU
✔ Skills companies are hiring for
✔ Step-by-step roadmap to get a job
👇 𝗦𝗮𝘃𝗲 𝘆𝗼𝘂𝗿 𝘀𝗽𝗼𝘁 𝗻𝗼𝘄 (𝗟𝗶𝗺𝗶𝘁𝗲𝗱 𝘀𝗲𝗮𝘁𝘀)
https://pdlink.in/4sNAyhW
Date & Time :- 18th March 2026 , 7:00 PM
Choose the Right Career Path in 2026
Learn → Level Up → Get Hired
🎯 Join this FREE Career Guidance Session & find:
✔ The right tech career for YOU
✔ Skills companies are hiring for
✔ Step-by-step roadmap to get a job
👇 𝗦𝗮𝘃𝗲 𝘆𝗼𝘂𝗿 𝘀𝗽𝗼𝘁 𝗻𝗼𝘄 (𝗟𝗶𝗺𝗶𝘁𝗲𝗱 𝘀𝗲𝗮𝘁𝘀)
https://pdlink.in/4sNAyhW
Date & Time :- 18th March 2026 , 7:00 PM
SQL Interview Questions for 0-1 year of Experience (Asked in Top Product-Based Companies).
Sharpen your SQL skills with these real interview questions!
Q1. Customer Purchase Patterns -
You have two tables, Customers and Purchases: CREATE TABLE Customers ( customer_id INT PRIMARY KEY, customer_name VARCHAR(255) ); CREATE TABLE Purchases ( purchase_id INT PRIMARY KEY, customer_id INT, product_id INT, purchase_date DATE );
Assume necessary INSERT statements are already executed.
Write an SQL query to find the names of customers who have purchased more than 5 different products within the last month. Order the result by customer_name.
Q2. Call Log Analysis -
Suppose you have a CallLogs table: CREATE TABLE CallLogs ( log_id INT PRIMARY KEY, caller_id INT, receiver_id INT, call_start_time TIMESTAMP, call_end_time TIMESTAMP );
Assume necessary INSERT statements are already executed.
Write a query to find the average call duration per user. Include only users who have made more than 10 calls in total. Order the result by average duration descending.
Q3. Employee Project Allocation - Consider two tables, Employees and Projects:
CREATE TABLE Employees ( employee_id INT PRIMARY KEY, employee_name VARCHAR(255), department VARCHAR(255) ); CREATE TABLE Projects ( project_id INT PRIMARY KEY, lead_employee_id INT, project_name VARCHAR(255), start_date DATE, end_date DATE );
Assume necessary INSERT statements are already executed.
The goal is to write an SQL query to find the names of employees who have led more than 3 projects in the last year. The result should be ordered by the number of projects led.
Sharpen your SQL skills with these real interview questions!
Q1. Customer Purchase Patterns -
You have two tables, Customers and Purchases: CREATE TABLE Customers ( customer_id INT PRIMARY KEY, customer_name VARCHAR(255) ); CREATE TABLE Purchases ( purchase_id INT PRIMARY KEY, customer_id INT, product_id INT, purchase_date DATE );
Assume necessary INSERT statements are already executed.
Write an SQL query to find the names of customers who have purchased more than 5 different products within the last month. Order the result by customer_name.
Q2. Call Log Analysis -
Suppose you have a CallLogs table: CREATE TABLE CallLogs ( log_id INT PRIMARY KEY, caller_id INT, receiver_id INT, call_start_time TIMESTAMP, call_end_time TIMESTAMP );
Assume necessary INSERT statements are already executed.
Write a query to find the average call duration per user. Include only users who have made more than 10 calls in total. Order the result by average duration descending.
Q3. Employee Project Allocation - Consider two tables, Employees and Projects:
CREATE TABLE Employees ( employee_id INT PRIMARY KEY, employee_name VARCHAR(255), department VARCHAR(255) ); CREATE TABLE Projects ( project_id INT PRIMARY KEY, lead_employee_id INT, project_name VARCHAR(255), start_date DATE, end_date DATE );
Assume necessary INSERT statements are already executed.
The goal is to write an SQL query to find the names of employees who have led more than 3 projects in the last year. The result should be ordered by the number of projects led.
❤2👍1
𝗙𝗿𝗲𝘀𝗵𝗲𝗿𝘀 𝗖𝗮𝗻 𝗚𝗲𝘁 𝗮 𝟯𝟬 𝗟𝗣𝗔 𝗝𝗼𝗯 𝗢𝗳𝗳𝗲𝗿 𝘄𝗶𝘁𝗵 𝗔𝗜 & 𝗗𝗦 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻😍
IIT Roorkee offering AI & Data Science Certification Program
💫Learn from IIT ROORKEE Professors
✅ Students & Fresher can apply
🎓 IIT Certification Program
💼 5000+ Companies Placement Support
Deadline: 22nd March 2026
📌 𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗡𝗼𝘄 👇 :-
https://pdlink.in/4kucM7E
Big Opportunity, Do join asap!
IIT Roorkee offering AI & Data Science Certification Program
💫Learn from IIT ROORKEE Professors
✅ Students & Fresher can apply
🎓 IIT Certification Program
💼 5000+ Companies Placement Support
Deadline: 22nd March 2026
📌 𝗥𝗲𝗴𝗶𝘀𝘁𝗲𝗿 𝗡𝗼𝘄 👇 :-
https://pdlink.in/4kucM7E
Big Opportunity, Do join asap!
❤1
✅ Essential Programming Acronyms You Should Know 💻🧠
API → Application Programming Interface
Set of rules allowing software apps to communicate and exchange data seamlessly.
IDE → Integrated Development Environment
Software suite combining tools like editor, debugger, and compiler for efficient coding.
OOP → Object-Oriented Programming
Paradigm organizing code around objects and classes for reusability and modularity.
HTML → HyperText Markup Language
Standard markup language for structuring web pages and content.
CSS → Cascading Style Sheets
Stylesheet language defining presentation and layout of HTML documents.
SQL → Structured Query Language
Language for managing and manipulating relational databases.
JSON → JavaScript Object Notation
Lightweight data-interchange format easy for humans and machines to parse.
DOM → Document Object Model
Tree-like representation of a web page's structure for dynamic manipulation.
CRUD → Create, Read, Update, Delete
Core database operations for managing data persistence.
SDK → Software Development Kit
Collection of tools, libraries, and docs for building on a platform.
UI → User Interface
Point of interaction between user and software application.
UX → User Experience
Overall feel of the interaction with a product or service.
CLI → Command Line Interface
Text-based interface for issuing commands to software.
HTTP → HyperText Transfer Protocol
Foundation protocol for data communication on the web.
REST → Representational State Transfer
Architectural style for designing scalable web APIs using standard HTTP methods.
💬 Tap ❤️ for more!
API → Application Programming Interface
Set of rules allowing software apps to communicate and exchange data seamlessly.
IDE → Integrated Development Environment
Software suite combining tools like editor, debugger, and compiler for efficient coding.
OOP → Object-Oriented Programming
Paradigm organizing code around objects and classes for reusability and modularity.
HTML → HyperText Markup Language
Standard markup language for structuring web pages and content.
CSS → Cascading Style Sheets
Stylesheet language defining presentation and layout of HTML documents.
SQL → Structured Query Language
Language for managing and manipulating relational databases.
JSON → JavaScript Object Notation
Lightweight data-interchange format easy for humans and machines to parse.
DOM → Document Object Model
Tree-like representation of a web page's structure for dynamic manipulation.
CRUD → Create, Read, Update, Delete
Core database operations for managing data persistence.
SDK → Software Development Kit
Collection of tools, libraries, and docs for building on a platform.
UI → User Interface
Point of interaction between user and software application.
UX → User Experience
Overall feel of the interaction with a product or service.
CLI → Command Line Interface
Text-based interface for issuing commands to software.
HTTP → HyperText Transfer Protocol
Foundation protocol for data communication on the web.
REST → Representational State Transfer
Architectural style for designing scalable web APIs using standard HTTP methods.
💬 Tap ❤️ for more!
❤3
📢 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗔𝗹𝗲𝗿𝘁 – Data Analytics with Artificial Intelligence
Upgrade your career with AI-powered data science skills.
Open for all. No Coding Background Required
📊 Learn Data Analytics with Artificial Intelligence from Scratch
🤖 AI Tools & Automation
📈 Build real world Projects for job ready portfolio
🎓 E&ICT IIT Roorkee Certification Program
🔥Deadline :- 22nd March
𝗔𝗽𝗽𝗹𝘆 𝗡𝗼𝘄 👇 :-
https://pdlink.in/4tkErvS
Don't Miss This Opportunity. Get Placement Assistance With 5000+ Companies
Upgrade your career with AI-powered data science skills.
Open for all. No Coding Background Required
📊 Learn Data Analytics with Artificial Intelligence from Scratch
🤖 AI Tools & Automation
📈 Build real world Projects for job ready portfolio
🎓 E&ICT IIT Roorkee Certification Program
🔥Deadline :- 22nd March
𝗔𝗽𝗽𝗹𝘆 𝗡𝗼𝘄 👇 :-
https://pdlink.in/4tkErvS
Don't Miss This Opportunity. Get Placement Assistance With 5000+ Companies
❤2