Coder Baba
2.42K subscribers
1.01K photos
23 videos
722 files
723 links
Everything about programming for beginners.
1 and only official telegram channel of CODERBABA India.

Content:
.NET Developer,
Programming (ASP. NET, VB. NET, C#, SQL Server),
& Projects
follow me https://linktr.ee/coderbaba
*Programming
*Coding
*Note
Download Telegram
Data Structure Notes👆👆
CRforVS6413SP32_0-80007712.zip
373.7 MB
Crystal Report Setup for Visual Studio
Coder Baba pinned a file
SweetAlert.zip
32.5 MB
Sweet alert js plugin for customize alert box in asp dot net website
Coder Baba pinned a file
Coder Baba pinned a file
Frequently asked SQL interview questions answer

1 - What is SQL and what are its main features?

Answer:
SQL (Structured Query Language) is a domain-specific language used for managing and manipulating relational databases.
Main features of SQL include:

-Data query and retrieval
-Data insertion, update, and deletion
-Schema creation and modification
-Data access control
-Transaction management


2 - Order of writing SQL query?

Answer:
The general order of writing an SQL query is:

1.SELECT
2.FROM
3.WHERE
4.GROUP BY
5.HAVING
6.ORDER BY
7.LIMIT/OFFSET (for databases that support pagination)


3 - Order of execution of SQL query?

Answer:
The order of execution of an SQL query is:

1.FROM clause
2.WHERE clause
3.GROUP BY clause
4.HAVING clause
5.SELECT clause
6.ORDER BY clause


4 - What are some of the most common SQL commands?

Answer:
Some of the most common SQL commands are:

-SELECT: Retrieves data from a database
-INSERT: Adds new data to a database
-UPDATE: Modifies existing data in a database
-DELETE: Removes data from a database
-CREATE: Creates a new database, table, or view
-ALTER: Modifies a database, table, or view structure
-DROP: Deletes a database, table, or view
-JOIN: Combines rows from two or more tables based on a related column


5 - What’s a primary key & foreign key?

Answer:

* Primary Key: A primary key is a unique identifier for a record in a table. It ensures that each record in a table is unique and not null.

* Foreign Key: A foreign key is a column or a set of columns in a table that establishes a link between the data in two tables. It establishes a relationship between the two tables and ensures referential integrity.


6 - All types of joins and questions on their outputs?

Answer:
Types of joins in SQL include:

-INNER JOIN: Returns records that have matching values in both tables.
-LEFT JOIN (or LEFT OUTER JOIN): Returns all records from the left table, and the matched records from the right table. If no match, NULL values are returned.

-RIGHT JOIN (or RIGHT OUTER JOIN): Returns all records from the right table, and the matched records from the left table. If no match, NULL values are returned.

-FULL JOIN (or FULL OUTER JOIN): Returns all records when there is a match in either the left or right table. If no match, NULL values are returned.



7 - Explain all window functions and difference between them?

Answer:
Window functions perform calculations across a set of table rows that are related to the current row. Common window functions include:

-ROW_NUMBER(): Assigns a unique sequential integer to rows within a partition of a result set.
-RANK(): Assigns a unique rank to rows within a result set.
-DENSE_RANK(): Similar to RANK() but without gaps in the ranking.
-NTILE(n): Divides the result set into n equally sized groups.
-LEAD(): Provides access to subsequent rows from the current row.
-LAG(): Provides access to previous rows from the current row.


8 - What is stored procedure?

Answer:
A stored procedure is a precompiled collection of one or more SQL statements and control-of-flow statements stored under a name in a database. It can be invoked using a simple call, providing better performance and security, and promoting modular programming.



9 - Difference between stored procedure & Functions in SQL?

Answer:

*Stored Procedure:
Can perform multiple SQL operations.
Can have input and output parameters.
Can't be used in SQL queries.
Can't be used in SELECT statements.
*Function:
Returns a single value.
Accepts only input parameters, doesn’t accept output parameters.
Can be used in SQL queries.
Can be used in SELECT statements.
2
follow for more
👍2