Ask Programiz - Human Support for Coding Beginners

Explore questions from fellow beginners answered by our human experts. Have some doubts about coding fundamentals? Enroll in our course and get personalized help right within your lessons.

  • All
  • Python
  • C
  • Java
  • CPP
  • SQL
  • JS
  • HTML
  • CSS
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Bruno,

Great question. Both NOT and <> / != can be used to exclude values, but there are cases where NOT is preferred for clarity.

Here’s when using NOT can make more sense:

  1. With complex conditions
    When you're excluding entire conditions or expressions, NOT can make things clearer:

    WHERE NOT (age < 18 OR country = 'UAE')
    
  2. With subqueries
    NOT IN and NOT EXISTS are common and often easier to read than alternatives:

    WHERE NOT EXISTS (SELECT * FROM ...)
    
  3. Improved readability
    In some cases, AND NOT country = 'UAE' might be easier to read than country != 'UAE', especially in long conditions.

That said, if you're just comparing single values, <> or != is shorter and works just as well:

WHERE country != 'UAE'

In the end, it comes down to readability and personal or team preference. Functionally, both work — pick the one that makes your intent clearest.

If you’ve got more questions, I’m here to help.

SQL
This question was asked as part of the Learn SQL Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Tom,

Yes, exactly — WHERE always comes before GROUP BY in SQL.

Here’s why: the WHERE clause filters the rows before any grouping happens. So only the rows that match your condition are included in the groups.

Let’s say you have this query:

SELECT department, MIN(age) AS min_age, MAX(age) AS max_age
FROM Employees
WHERE department <> 'Marketing'
GROUP BY department;

First, SQL filters out all rows where the department is 'Marketing'. Then it groups the remaining rows by department and calculates the min and max age for each group.

If you applied the WHERE after GROUP BY, it wouldn’t work — because WHERE doesn’t operate on groups. That’s what HAVING is for, if you ever need to filter after grouping.

So yes, WHERE always comes first.

If you have more questions, I am here to help.

SQL
This question was asked as part of the Learn SQL Basics course.
Chika Lucinda Barn-Nzekwe
last year
Chikacountry asked
Kelish Rai
Expert
last year
Kelish Rai answered

Hi Chika,

int stands for integer, which means whole numbers — no decimals. Examples include 5, 42, or -100.

In most programming languages, including C and C++, int is used to declare variables that store whole numbers:

int age = 25;

That line creates a variable named age that holds the value 25.

If you have more questions, I am here to help.

SQL
This question was asked as part of the Learn SQL Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Julia,

Yes, that’s correct — if you don’t use a TCL command like COMMIT, your changes may not be saved permanently.

When you run SQL statements like INSERT, UPDATE, or DELETE, the changes happen in a temporary state called a transaction. They're not actually saved to the database until you explicitly commit them:

COMMIT;

If you don’t run COMMIT, and you close the connection or something goes wrong, those changes can be rolled back — meaning they’re lost.

You can also use:

  • ROLLBACK to undo changes

  • SAVEPOINT to mark specific points you might roll back to

So yes — using TCL commands like COMMIT is what finalizes your changes.

If you have more questions, I am here to help.

SQL
This question was asked as part of the Learn SQL Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi there! This is a great question and it's quite common for SQL learners to wonder about these nuances.

When writing a GRANT or REVOKE clause, the use of * and ALL TABLES might seem similar because they both refer to permissions applied to all tables within a database. However, depending on the SQL database system you are using, they might function slightly differently and could have different levels of compatibility and specificity.

- ***:** This is sometimes used as shorthand to represent operations across all tables in a database, but it heavily depends on the SQL database implementation you're dealing with. It's often more associated with selecting all columns in a SELECT statement than granting permissions. - **ALL TABLES:** This statement is very clear in intent, explicitly specifying that the action should apply to all tables. It's generally more explicit and more reliably interpreted across different SQL systems for data control operations.

Given this, ALL TABLES is the more universally accepted syntax for granting/revoking permissions across all tables in most SQL systems, which provides less ambiguity in cross-database usage.

Please, let me know if you have any further questions or if you'd like to see more examples. Hope this helps!

SQL
This question was asked as part of the Learn SQL Basics course.
Varun
last year
Varuncountry asked
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

A DBMS, or Database Management System, is software that helps you create, maintain, and use your databases. Here's a quick breakdown:

  • Store Data: A DBMS allows you to store data efficiently.

  • Query Data: You can use a language like SQL to ask questions and get specific data out.

  • Update Data: As data changes, a DBMS lets you keep your data up-to-date by adding, editing, or deleting information.

  • Organize Data: It helps organize data into tables, rows, and columns, making it easier to understand and use.

If you're getting started with SQL, think of a DBMS as the tool that makes it all happen behind the scenes, i.e., enabling you to interact with the data stored in databases.

For example, if you use SQL to write a query like:

SELECT * FROM employees;

This command asks the DBMS to show you all the data from the employees table, and the DBMS processes that request.

Understanding what a DBMS is and how it works will be foundational as you learn to write more complex SQL queries.

SQL
This question was asked as part of the Learn SQL Basics course.
Abhay Jajodia
Expert
last year
Abhay Jajodia answered

In SQL, when you use the NOT BETWEEN operator, it will filter out all values that fall within the given range, including the start and end numbers.

So, in the following example:

SELECT first_name, country, age  
FROM Customers  
WHERE age NOT BETWEEN 22 AND 28;

This query is filtering out customers whose ages are 22 through 28, not 23 through 27.

By using NOT BETWEEN 22 AND 28, it means ages 22, 23, 24, 25, 26, 27, and 28 will be excluded.

If your intention is to exclude just from 22 through 27, you'd phrase it like:

SELECT first_name, country, age  
FROM Customers  
WHERE age NOT BETWEEN 22 AND 27;

If you meant to exclude up to but not including 28, then the range should definitely stop at 27 for your query.

Hope this helps clear things up! Let me know if you have more questions.

SQL
This question was asked as part of the Learn SQL Basics course.
Kelish Rai
Expert
last year
Kelish Rai answered

First of all, if you're new here, welcome!

Let me give you a quick introduction to our website, Programiz PRO.

Programiz PRO is a platform designed to teach programming to complete beginners. We offer courses in several programming languages, including Python, JavaScript, and C.

Our approach focuses on hands-on learning. Each course walks you through key concepts step by step, followed by practice exercises and quizzes to reinforce what you've learned. We also use helpful illustrations to make things easier to understand, and the platform includes several tools to support you throughout your learning journey.

One of those tools is this feature, where you can directly reach out to Programiz experts if you have questions while going through the course.

Feel free to reach out if anything is unclear or if you’d like help with something. I'm happy to help.

SQL
This question was asked as part of the Learn SQL Basics course.
Palistha Singh
Expert
last year

That's a great question!

Working with SQL is different from entering data into Excel because, with SQL, you don't manually type or organize the data yourself.

Instead, the data is already stored in a database, and you use SQL commands to find, retrieve, organize, and analyze that data automatically.

In Excel, you often work with small amounts of data by hand. In SQL, you can work with huge amounts of data much faster and more efficiently using simple queries.

If you have more questions, I'm here to help!

SQL
This question was asked as part of the Learn SQL Basics course.
Sudip Bhandari
Expert
last year

Hi there! ROWS BETWEEN can be a bit confusing at first, so let’s break it down together.

First, ROWS BETWEEN is not actually a window function itself. Instead, it's a clause used inside a window function to define which rows should be considered for the calculation. It's like setting the boundaries or frame for your data analysis.

When you see the code

AVG(closing_price) OVER (
    ORDER BY date
    ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
)

The part "ROWS BETWEEN 6 PRECEDING AND CURRENT ROW" tells SQL to calculate the average of the current row and the past six rows, effectively allowing us to compute a 7-day moving average.

By specifying these boundaries, SQL knows how far back or forward to look from each row in the dataset when performing the calculation.

Hope this helps make things clearer! Feel free to ask if you have any more questions.

SQL
This question was asked as part of the Learn SQL Basics course.