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
⛳️LINQ in ASP .NET (short Note by Coderbaba)⛳️

⚡️LINQ: Language Integrated Query


👉🏻-it is a Query Language that is pronounced as "link" is designed and introduced by Microsoft for .NET technology that addds data querying capabilities to .NET Languages .
👉🏻-LINQ introduced in .NET 3.5 (Visual Studio 2008) using LINQ we can write Queries on Array, Collections, XML Source and Relational Databases.

👉🏻-LINQ is as same as SQL but sql can be used only on relational database but linq can be used on a wide variety of data sources like Array,Collections, XML source and Relational databases.

👉🏻-Query expressions are written in a declarative query syntax.By using query syntax, you can perform filtering , ordering , and grouping operations on data sources with a minimum of code.

👉🏻-LINQ query expressions, are similar to

⛳️LINQ is divided into 3 parts, those are:⛳️

1-LINQ to Objects : => Array and Collection
2-LINQ to XML (XLINQ): => XML Source
3-LINQ to Database: Relational Database (SQL Server)

Note:
----------------------
🚀linq to obj:
this type of programming called imperative programming.

🚀linq to database:
it is called as declarative programming.
-------------------

All LINQ query operations consist of three distinct actions:
1-Obtain the data source
2-Create the query
3-Execute the query

😎LINQ Query Expressions:
LINQ query expressions are witten in a declarative SQL like syntax.

Example:
get those student name from array which has more than 3 characters:

------------
string studentName={"Raj","Mohan","John","Sima","Tanu"};

IEnumerable<string> subset=
from n in studentName where
n.Length>3 orderby n select n;

foreach (string s in subset)
Console.WriteLine("Name:{0}",s);

-----------------------------

👉🏻-The standard query operators provide query capabilities including
*Filtering-where
*Project-select,selectMany
*Aggregation-Sum,Max,Count,Average
*Sorting-orderby
*Grouping-groupby
*...and many more



-----------------
🌎Query Expression Trees:
A query expression trees is an efficient data structure representing a LINQ expression
- type of abstract syntax tree used for storing parsed expresssions from the source code.

-Lambda expressions often translate into query expression trees.

IQueryable<T> is interface implemented by query providers (e.g. LINQ to SQL, LINQ to XML, LINQ to Obj)

IQueryable<T> objects use expression trees

--------------------------------------------

⛳️LINQ to SQL:⛳️
-----------------

Select Statement

SQL: Select * from Customer where City="India"

LINQ:
var q =from c in Customer where c.City=="India" select c;

⛳️Why LINQ Beats SQL:⛳️
-------------------
-SQL is a very old langauage invented in 1974.
since then it is been extended endlessly, but never redesigned and this has made the language messy.

-LINQ is the language with syntax of C# and Visual Basic
simpler,tidier and higher level

Ex:

SQL: select UPPER(Name) from Customer where Name LIKE'A%' Order by Name

LINQ:
var qr=from c in Customer where c.Name.StartsWith("A")
orderby c.Name select c.Name.ToUpper();

------------------

Simpler how?

ex:

💻SQL query:

select top 10 Upper(c1.Name) from Customer c1
where c1.Name LIKE 'A%' AND c1.ID NOT IN
(
select Top 20 c2.ID from Customer c2 where c2.Name LIKE 'A%' Order by c2.Name
)Order by c1.Name


💻LINQ:

var qr=from c in Customer where c.Name.StartsWith("A")
orderby c.Name
select c.Name.ToUpper();
var result=query.Skip(20).Take(10);

-------------------------------------

🏆Example code :
🧜‍♂️LINQ Query:-

1-👉🏻
var bmws = from car in myCars
where car.Make == “BMW”
&& car.Year == 2010
select car;

2-👉🏻
var orderedCars = from car in myCars
orderby car.Year descending
select car;


// LINQ method:

1-🚩
var bmws = myCars.Where(p => p.Make == “BMW” && p.Year == 2010);

2-🚩
var orderedCars = myCars.OrderByDescending(p => p.Year);

3-🚩
var firstBMW = myCars.OrderByDescending(p => p.Year).First(p => p.Make == “BMW”);
Console.WriteLine(firstBMW.VIN);

4-🚩
Console.WriteLine(myCars.TrueForAll(p => p.Year > 2007));

5-🚩
myCars.ForEach(p => p.StickerPrice -= 3000);
👍1
6-🚩
myCars.ForEach(p => Console.WriteLine(“{0} {1:C}”, p.VIN, p.StickerPrice));

7-🚩
Console.WriteLine(myCars.Exists(p => p.Model == “745li”));

8-🚩
Console.WriteLine(myCars.Sum(p => p.StickerPrice));


9-🚩
foreach (var car in orderedCars)
{
Console.WriteLine(“{0} {1}”, car.Year, car.Model, car.VIN);
}
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
🚀 Check out my YouTube tutorial: "Mastering JavaScript from Basic to Advanced" 🌟
Whether you're just starting out or looking to level up your skills, this comprehensive guide has got you covered!
💻🔥 Dive into the world of JavaScript and unlock its full potential with step-by-step lessons and hands-on examples.
💡 Don't miss out on the chance to become a JavaScript pro! Watch the tutorial now by clicking the link below:

https://youtu.be/cdgrKbB4V78?si=_uYhtj246MuIRl-6

🔖 #JavaScriptTutorial #LearnJavaScript #JavaScriptBasics #JavaScriptAdvanced #CodingTutorial #WebDevelopment #FrontendDevelopment #Programming #TechEducation #OnlineLearning #DeveloperSkills 🚀
follow @coder_baba
#coderbaba #dotnet #coding
👍1
10 AI Tools to Replace your Tedious Work:
------------------------------------------------------

1. 10web.io - AI Website Builder

2. Lovo.ai - AI Voice Generator

3. Opus.pro - Create viral videos in sec

4. Tldv.io - AI Meeting Assistant

5. Perplexity.ai - Use AI while browsing

6. Kickresume.com - AI Resume Builder

7. Rytr.me - Personal AI copywriter

8. Eightify.app - Summarize YouTube video

9. Chatpdf.com - Chat with any PDF

10. Sheetplus.ai - Write excel formulas with AI

follow for more
Subscribe my youtube channel
https://www.youtube.com/@coderbaba?sub_confirmation=1

#coderbaba #coding #programming #dotnet #project #sourcecode #technology #AI #AITools
💯DSA INTERVIEW QUESTIONS AND ANSWERS

1. What is the difference between file structure and storage structure?
The difference lies in the memory area accessed. Storage structure refers to the data structure in the memory of the computer system,
whereas file structure represents the storage structure in the auxiliary memory.

2. Are linked lists considered linear or non-linear Data Structures?
Linked lists are considered both linear and non-linear data structures depending upon the application they are used for. When used for
access strategies, it is considered as a linear data-structure. When used for data storage, it is considered a non-linear data structure.

3. How do you reference all of the elements in a one-dimension array?
All of the elements in a one-dimension array can be referenced using an indexed loop as the array subscript so that the counter runs
from 0 to the array size minus one.

4. What are dynamic Data Structures? Name a few.
They are collections of data in memory that expand and contract to grow or shrink in size as a program runs. This enables the programmer
to control exactly how much memory is to be utilized.Examples are the dynamic array, linked list, stack, queue, and heap.

5. What is a Dequeue?
It is a double-ended queue, or a data structure, where the elements can be inserted or deleted at both ends (FRONT and REAR).

6. What operations can be performed on queues?
enqueue() adds an element to the end of the queue
dequeue() removes an element from the front of the queue
init() is used for initializing the queue
isEmpty tests for whether or not the queue is empty
The front is used to get the value of the first data item but does not remove it
The rear is used to get the last item from a queue.

7. What is the merge sort? How does it work?
Merge sort is a divide-and-conquer algorithm for sorting the data. It works by merging and sorting adjacent data to create bigger sorted
lists, which are then merged recursively to form even bigger sorted lists until you have one single sorted list.

8.How does the Selection sort work?
Selection sort works by repeatedly picking the smallest number in ascending order from the list and placing it at the beginning. This process is repeated moving toward the end of the list or sorted subarray.

Scan all items and find the smallest. Switch over the position as the first item. Repeat the selection sort on the remaining N-1 items. We always iterate forward (i from 0 to N-1) and swap with the smallest element (always i).

Time complexity: best case O(n2); worst O(n2)

Space complexity: worst O(1)

9. What are the applications of graph Data Structure?
Transport grids where stations are represented as vertices and routes as the edges of the graph
Utility graphs of power or water, where vertices are connection points and edge the wires or pipes connecting them
Social network graphs to determine the flow of information and hotspots (edges and vertices)
Neural networks where vertices represent neurons and edge the synapses between them

10. What is an AVL tree?
An AVL (Adelson, Velskii, and Landi) tree is a height balancing binary search tree in which the difference of heights of the left
and right subtrees of any node is less than or equal to one. This controls the height of the binary search tree by not letting
it get skewed. This is used when working with a large data set, with continual pruning through insertion and deletion of data.

11. Differentiate NULL and VOID ?
Null is a value, whereas Void is a data type identifier
Null indicates an empty value for a variable, whereas void indicates pointers that have no initial size
Null means it never existed; Void means it existed but is not in effect

12. Do dynamic memory allocations help in managing data? How?
Dynamic memory allocation stores simple structured data types at runtime. It has the ability to combine separately allocated
structured blocks to form composite structures that expand and contract as needed, thus helping manage data of data blocks
of arbitrary size, in arbitrary order.

💻Follow for more
🚀 Introducing final year project: "Online Examination System"! 🎓
💻 Built with ASP.NET C#, HTML, Bootstrap, JavaScript, and SQL Server database,
this project is perfect for final year students eager to develop web applications using cutting-edge .NET technology.
💡 Get hands-on experience and comprehensive training with this comprehensive project.

🔍 Dive into the world of web development and master the skills needed to create robust, user-friendly applications!
💼💻 Don't miss out on this opportunity to enhance your portfolio and impress potential employers.

Download the complete source code

🚀 Ready to take your coding skills to the next level?
Subscribe to my YouTube channel #coderbaba for more tutorials, project demos, and tech insights! 🎥
https://www.youtube.com/@coderbaba?sub_confirmation=1

#FinalYearProject #OnlineExaminationSystem #ASPdotNET #CSharp #HTML #Bootstrap #JavaScript #SQLServer #WebDevelopment #Coding #Programming #TechSkills #DeveloperTraining #CoderBaba
@coder_baba