What does the symbol do in SQL

0 votes

I was browsing through the questions and noticed this:

SELECT prodid, issue
FROM Sales 
WHERE custid = @custid 
AND datesold = SELECT MAX(datesold) 
             FROM Sales s 
             WHERE s.prodid = Sales.prodid
                  AND s.issue = Sales.issue
                  AND s.custid = @custid

What is the purpose of the "@" before custID, I wondered? Is it merely a method of referencing the custID from the specified table?

Sep 8, 2022 in Database by Kithuzzz
• 38,000 points
1,318 views

1 answer to this question.

0 votes
The @CustID denotes a parameter for which you will subsequently provide a value in your code. The most effective method of preventing SQL injection is this. Instead of concatenating strings and variables, construct your query using parameters. There is no potential for SQL injection because the database engine inserts the parameter value where the placeholder resides.

I hope this helps you.
answered Sep 10, 2022 by narikkadan
• 63,600 points

Related Questions In Database

0 votes
1 answer

What are the manipulation functions in SQL?

There are three case manipulation functions in ...READ MORE

answered Oct 11, 2018 in Database by DataKing99
• 8,250 points
5,502 views
0 votes
1 answer

What are the different authentication modes in SQL Server? How can it be changed?

Windows mode and Mixed Mode – SQL ...READ MORE

answered Oct 29, 2018 in Database by Sahiti
• 6,370 points
1,222 views
0 votes
1 answer

What are the different types of join in SQL?

Hi Suraj, You have a doubt regarding inner join ...READ MORE

answered May 28, 2019 in Database by sampriti
• 1,120 points
1,311 views
0 votes
1 answer

What is the definition of cardinality in SQL?

Cardinality is defined as the "number of ...READ MORE

answered Feb 15, 2022 in Database by Neha
• 9,020 points
1,877 views
0 votes
1 answer

Which query to use for better performance, join in SQL or using Dataset API?

DataFrames and SparkSQL performed almost about the ...READ MORE

answered Apr 19, 2018 in Apache Spark by kurt_cobain
• 9,350 points
1,858 views
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

answered May 11, 2018 in Java by Parth
• 4,640 points
1,931 views
0 votes
1 answer
0 votes
1 answer

Automating Oracle script with nolio

Depending upon the details of your script ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by ajs3033
• 7,300 points
1,080 views
0 votes
1 answer

What is the use of a cursor in SQL Server?

Instead of receiving a result set as ...READ MORE

answered Sep 13, 2022 in Database by narikkadan
• 63,600 points
800 views
0 votes
1 answer

How do I perform the SQL Join equivalent in MongoDB?

The majority of the responses to this ...READ MORE

answered Sep 15, 2022 in Database by narikkadan
• 63,600 points
1,396 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP