Coder Baba
2.41K 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
𝐒𝐐𝐋_π‡πšπ§ππ°π«π’π­π­πžπ§_𝐍𝐨𝐭𝐞𝐬.pdf
1.1 MB
🌱SQL Handwritten Notes
Follow @coder_baba #coderbaba #SQL
SQL is the one of the important topic of any technical interview.
Make sure you are well prepared for it.

I am sharing this simple and scrips notes on SQL, hope it helps you understand SQL in simple way.

Do not forget to follow @coder_baba for more such awesome technical notes.

credit : Unknown
🎯Important SQL Interview Question:

πŸ”°Q. What are the different types of indexes?
Ans:
βœ…An index is a performance tuning method of allowing faster retrieval of
records from the table. An index creates an entry for each value and makes
it faster to retrieve data.
There are three types of indexes:
1️⃣Unique Index: This indexing does not allow the field to have duplicate
values if the column is unique indexed. Unique index can be applied
automatically when primary key is defined.
2️⃣Clustered Index: This type of index reorders the physical order of the
table and search based on the key values. Each table can have only one
clustered index.
3️⃣Non-Clustered Index: Non-Clustered Index does not alter the physical
order of the table and maintains logical order of data. Each table can
have 999 nonclustered indexes.



πŸ”°Q.What is a cursor in SQL?
βœ…A database Cursor is a control which enables traversal over the rows or
records in the table. This can be viewed as a pointer to one row in a set of
rows. Cursor is very much useful for traversing such as for retrieval, addition
and removal of database records.

πŸ”°Q.What is a trigger?
βœ…A DB trigger is a code or programs that automatically execute with response
to some event on a table or view in a database. Mainly, trigger helps to
maintain the integrity of the database.
Example: When a new student is added to the student database, new
records should be created in the related tables such as the Exam, Score and
Attendance tables.

πŸ”°What are constraints?
βœ…Constraint can be used to specify the limit on the data type of table.
Constraint can be specified while creating or altering the table statement.

πŸ”°Q. What is data integrity?
βœ…Data Integrity defines the accuracy and consistency of data stored in a
database. It can also define integrity constraints to enforce business rules
on the data when it is entered into the application or database.

πŸ”°Q What is auto increment?
βœ…Auto increment keyword allows the user to create a unique number to be
generated when a new record is inserted into the table. AUTO INCREMENT
keyword can be used in Oracle and IDENTITY keyword can be used in SQL
SERVER.

πŸ”°Q. What is a data warehouse?
βœ…Data warehouses are a central repository of data from multiple sources of
information. This data is consolidated, transformed and made available for
the mining and online processing. Warehouse data have subsets of data
called Data Marts.

πŸ”°Q. What is the difference between DROP and TRUNCATE statements?
βœ…TRUNCATE removes all the rows from the table, and it cannot be rolled
back. DROP command removes a table from the database and operation
cannot be rolled back.

πŸ”°Q. What are aggregate and scalar functions?
βœ…Functions are methods used to perform data operations. SQL has many inbuilt functions used to perform string concatenations, mathematical
calculations etc.

SQL functions are categorized into the following two categories:
Aggregate Functions and Scalar Functions.

Aggregate SQL Functions-
The Aggregate Functions in SQL perform calculations on a group of values
and then return a single value. Following are a few of the most commonly
used Aggregate
SUM(), COUNT(), AVG(), MIN(), MAX(), FIRST() & LAST()

The Scalar Functions- in SQL are used to return a single value from the given
input value. Following are a few of the most commonly used Scalar
LCASE(), UCASE(), LEN(), MID(), ROUND(), NOW(), FORMAT()

πŸ”°Q.What is alias in SQL?
βœ…SQL aliases are used to give a table, or a column in a table, a temporary
name. Aliases are often used to make column names more readable. An
alias only exists for the duration of that query. An alias is created with the
AS keyword

Follow for more @Coder_Baba
#Coderbaba #CSharpTutorials #SQL
sharing some Interview questions #sql #intermediate

1. How to select random rows from a table?
-> Using the RAND() function in combination with ORDER BY and LIMIT. In Mysql we use RAND() which returns random records from table.
SELECT * FROM table_name
ORDER BY RAND()
LIMIT 5;

2. How to find the last id in a table?
-> By using MAX(), We use following syntax
SELECT id
FROM table_name
ORDER BY id DESC
LIMIT 1;

3. How to find the values in a text column of a table that start with a certain letter?
-> Using the LIKE operator in combination with the % and _ wildcards. For example, we need to find all surnames in a table that start with "A". The query is:
SELECT * FROM table_name
WHERE surname LIKE 'A_';
sharing some Interview questions #sql #advance

1. What are Window Functions?
-> A Window Function performs a calculation across a set of table rows that are somehow related to the current row. Window functions are initiated by the OVER() clause. Another important clause is PARTITION BY, which defines data partitions within a window frame. When this clause is omitted, the partition is the entire result table. Another important clause is ORDER BY. It sorts data within the window.

2. What Window Functions do you know?
-> SQL window functions can be generally divided into four categories:
a. Ranking Functions
b. Distribution Functions
c. Analytic Functions
d. Aggregate Functions

a. The Ranking functions are:
1. ROW_NUMBER() – Returns a unique number for each row within a partition; tied values have different row numbers.
2. RANK() – Ranks data within a partition; tied values have the same rank, and there’s a gap following ties (e.g. 1, 2, 3, 3, 5).
3. DENSE_RANK() – Ranks data within a partition; tied values have the same rank and there’s no ranking gap (e.g. 1, 2, 3, 3, 4).

b. The Distribution functions are:
1. PERCENT_RANK() – Returns the relative rank within a partition.
2. CUME_DIST() – Returns the cumulative distribution within a partition.

c. The Analytic functions are:
1. LEAD() – Allows accessing values from a subsequent row in relation to the current row.
2. LAG() – Allows accessing values from a previous row in relation to the current row.
3. NTILE() – Divides rows within a partition into approximately equal groups.
4. FIRST_VALUE() – Allows accessing values from the first row within a partition.
5. LAST_VALUE() – Allows accessing values from the last row within a partition.
6. NTH_VALUE() – Allows accessing the nth row within a partition.

d. The Aggregate functions are:
1. AVG() – Returns an average value for the rows in a partition.
2. COUNT() – Returns the number of values in the rows in a partition.
3. MAX() – Returns the maximum value for the rows in a partition.
4. MIN() – Returns the minimum value for the rows in a partition.
5. SUM() – Returns the sum value of the rows in a partition.
πŸ‘2
Are you preparing for an SQL interview? Here are some essential SQL questions to help you ace your next interview! πŸ‘¨β€πŸ’»πŸ“Š
πŸ” Basic SQL Concepts:
πŸ“Œ Explain the difference between SQL and NoSQL databases.
πŸ“Œ What are the common data types in SQL?
πŸ“‹ Querying:
πŸ“Œ How do you retrieve all records from a table named "Customers"?
πŸ“Œ What is the difference between SELECT and SELECT DISTINCT in a query?
πŸ“Œ Explain the purpose of the WHERE clause in SQL queries.
πŸ”— Joins:
πŸ“Œ Describe the types of joins in SQL (INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN).
πŸ“Œ How would you retrieve data from two tables using an INNER JOIN?
πŸ“Š Aggregate Functions:
πŸ“Œ What are aggregate functions in SQL? Can you name a few?
πŸ“Œ How do you calculate the average, sum, and count of a column in a SQL query?
πŸ” Grouping and Filtering:
πŸ“Œ Explain the GROUP BY clause and its use in SQL.
πŸ“Œ How would you filter the results of an SQL query using the HAVING clause?
πŸ”„ Subqueries:
πŸ“Œ What is a subquery, and when would you use one in SQL?
πŸ“Œ Provide an example of a subquery in an SQL statement.
πŸ”§ Indexes and Optimization:
πŸ“Œ Why are indexes important in a database?
πŸ“Œ How would you optimize a slow-running SQL query?
πŸ“š Normalization and Data Integrity:
πŸ“Œ What is database normalization, and why is it important?
πŸ“Œ How can you enforce data integrity in a SQL database?
βš™οΈ Transactions:
πŸ“Œ What is a SQL transaction, and why would you use it?
πŸ“Œ Explain the concepts of ACID properties in database transactions.
πŸ“‹ Views and Stored Procedures:
πŸ“Œ What is a database view, and when would you create one?
πŸ“Œ What is a stored procedure, and how does it differ from a regular SQL query?
πŸ”₯ Advanced SQL:
πŸ“Œ Can you write a recursive SQL query, and when would you use recursion?
πŸ“Œ Explain the concept of window functions in SQL.
πŸ“Œ For more SQL insights and tutorials, follow #coderbaba and stay tuned for more updates! πŸ’‘
#SQL #SQLServer #Database #InterviewPreparation #Coding #Programming
Follow @Coder_baba
πŸ‘3
πŸ” SQL Server Database Constraints Demystified: Boosting Data Integrity and Efficiency πŸ”
Understanding database constraints is pivotal for ensuring robust data integrity and improving efficiency in SQL Server. Here's a quick rundown of the key types of constraints every developer should be familiar with:

πŸ“Œ Types of Constraints:
1-Default constraint
2-Not Null constraint
3-Primary key constraints
4-Foreign Key constraints
5-Unique Key constraints
6-Check constraint
Implementing the right constraints can significantly enhance the reliability and performance of your database. Stay tuned for more insights and best practices! πŸš€
Link: https://youtu.be/7gjPhqpRvB0



πŸ”— Hashtags:
#CoderBaba @coder_baba
#DatabaseConstraints #DataIntegrity #SQLQueries #PrimaryKey #ForeignKey #UniqueKey #CheckConstraint #DatabaseDesign #SQL #DatabaseOptimization #RelationalDatabase #SQL #Database #DataIntegrity #Coding #Programming #TechTips #WebDevelopment
#SoftwareEngineering #DataManagement #ITProfessional
#SQLServer #DatabaseConstraints #DataIntegrity #SQLTips
#DatabaseManagement
πŸ‘1
SQL_For_Data_Scientists_A_beginner's_Guide_for_Building_Datasets.pdf
14.9 MB
πŸ“Š Exciting news for aspiring Data Scientists! πŸš€

Embark on your journey into the realm of data analysis with our latest guide: "SQL For Data Scientists: A Beginner's Guide for Building Datasets for Analysis." πŸ“ˆπŸ’»

In this comprehensive beginner's guide, you'll delve into the fundamentals of SQL, mastering the skills needed to build robust datasets for analysis. Whether you're a seasoned professional looking to enhance your skill set or a newcomer eager to explore the world of data science, this guide is tailored just for you! πŸŽ“βœ¨

Ready to take your first steps towards becoming a data analysis expert? Join us on this exciting adventure! Access the guide now and unlock the secrets of SQL for data scientists. πŸ’‘

πŸ”— Join our Telegram community @coder_baba for more insights, resources, and discussions on data science and programming. Let's learn and grow together! πŸŒ±πŸ’¬

#DataScience #SQL #BeginnersGuide #DataAnalysis #LearnToCode #DataScienceCommunity #JoinUs #TelegramGroup #CoderBaba #LinkedInLearning
🫑1