Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 142919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:00:47+00:00 2026-05-11T08:00:47+00:00

Specifically I am trying to grasp how SQL statements differ from normal C style

  • 0

Specifically I am trying to grasp how SQL statements differ from normal C style programming, I can’t seem to understand how to do stuff like ‘for every userid in this table that has another column of data equal to such and such, run this stored procedure’ which in programming would be a for loop, how the heck do you do stuff like that?

Or like, for each row in tableA that has a contentID of 11, add a new row to tableB containing this data and the userID from the row of tableA found containing contentID of 11…

Anyone mind possibly writing a bit on how I should understand SQL statements compared to programming? I feel like I could wield it better if I understood how I was suppose to think about it…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:00:48+00:00Added an answer on May 11, 2026 at 8:00 am

    They are approaching the world from different points of view. C is about performing actions. SQL is about storing data, and manipulating data. The only ‘actions’ it is good at are pulling and changing data.

    Think of all your data like a Venn diagram– SQL lets you ‘look’ at any part of that diagram you want.

    If you want to actually do something to that data, then in C, you might say ‘Go to every user and perform this action on them’, as in

    //if a customer is late, send them a reminder for(int i=0;i<USER_COUNT-1;++i){   if(LATE_ON_PAYMENTS=CustomerType(Customers[i])){     SendReminder(Customers[i]);   }  //if cust is late on their payments }  //for ea customer 

    In SQL, you would be able to ASK for the list of users, as in:

    SELECT * FROM CUSTOMERS WHERE LATE_FLAG = 'Y'; 

    Or you could change data regarding those customers, as in:

    UPDATE CUSTOMERS SET TRUST_LEVEL = TRUST_LEVEL - 1  --trust a little less when they are late WHERE LATE_FLAG = 'Y'; 

    Note that this UPDATE could affect any number of rows, but there is no loop… you are simply saying ‘look up these records, and change them in this way’.

    But if you wanted to send them a reminder, well that’s just too bad… you’ve got to use C or a stored procedure to do that.

    You really get the best of both worlds when you combine a traditional language with SQL. If you can replace the earlier example in C with this (disclaimer: I know this is bogus code, it’s just an example):

    //if a customer is late, send them a reminder  //get all the late customers sqlCommand = 'SELECT CUSTOMER_ID FROM CUSTOMERS WHERE LATE_FLAG = ''Y'''; dataSet = GetDataSet(sqlCommand);  //now loop through the late customers i just retrieved     for(int i=0;i<dataSet.RecordCount - 1;++i){   SendReminder(dataSet[i].Field('CUSTOMER_ID')); }  //for ea customer 

    Now the code is more readable, and everyone is pointed at the same data source at runtime. You also avoid the potentially messy code in C that would have been involved in building your list of customers – now it is just a dataset.

    Just as SQL sucks at doing imperative actions, C sucks at manipulating data sets. Used together, they can easily get data, manipulate it, and perform actions on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 400k
  • Answers 400k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you have to re purchase the keys, since they are… May 15, 2026 at 4:11 am
  • Editorial Team
    Editorial Team added an answer Base64 representation is universaly used to represent binary data. public… May 15, 2026 at 4:11 am
  • Editorial Team
    Editorial Team added an answer Something like that? import java.lang.reflect.Field; /* ... */ for (int… May 15, 2026 at 4:11 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.