SQL For .NET Programmers

Recent Posts

Calendar

April 2014
S M T W T F S
« Mar    
 12345
6789101112
13141516171819
20212223242526
27282930  

ms-sql

SQL WHILE – SQL For Programmers

The IF statement we looked at on Tuesday was pretty tame compared to the WHILE construct.

Actually, the main thing you need to keep in mind is that WHILE is all you have.  There is no such thing as a FOR loop or a DO WHILE loop. … Read the rest

SQL – Filtering WHERE condition on two rows

iStock_000005792139Medium I received the following question a couple of days ago from a programmer using the “Ask  a Question” form which you can access from the menu of this blog:

Given the following table:

Name Language
Nikhil Hindi
Nikhil English
Kisu Hindi
Kisu English
Rakesh Hindi
Kousik Bangali

How do I select names of persons who know both Hindi and English?… Read the rest

Random in SQL – SQL For Programmers

IMG_1382 Last week I had an interesting assignment: Given a specific record, randomly retrieve three related records from the database.

Naturally, as a programmer, I started looking for the SQL random function.  Which I found.

But even as I was searching for how to use that function, I was thinking to myself, “How am I going to structure things in such a way so as to randomly select the records once I have the function? … Read the rest

Basic SQL Commands – SQL For Programmers

Before we get into the specifics of the commands that can be used within a stored procedure, I think it would be helpful to review some of the more basic commands that we can use that don’t really need a whole lot of discussion.… Read the rest

SQL For Programmers – Stored Procedure Basics

trav-035 Now that we’ve established a reason for using them, let’s continue with the basic syntax of the stored procedure. I think you’ll find that it is not that dissimilar to writing a procedure in any other language. Although, as we move on, I think you’ll find that the syntax we have to use to get anything done is quite cryptic.… Read the rest