Difference between single and double quotes in SQL

0 votes
Hi!!

Can someone tell me what is the difference between single and doubt quotes in SQL?
Sep 11, 2018 in Database by Sahiti
• 6,360 points
13,291 views

1 answer to this question.

0 votes

Single quotes are used to indicate the beginning and end of a string in SQL. Double quotes generally aren't used in SQL, but that can vary from database to database.

Stick to using single quotes.

That's the primary use anyway. You can use single quotes for a column alias — where you want the column name you reference in your application code to be something other than what the column is actually called in the database. For example: PRODUCT.id would be more readable as product_id, so you use either of the following:

  • SELECT PRODUCT.id AS product_id
  • SELECT PRODUCT.id 'product_id'

Either works in Oracle, SQL Server, MySQL… but I know some have said that the TOAD IDE seems to give some grief when using the single quotes approach.

You do have to use single quotes when the column alias includes a space character, e.g., product id, but it's not recommended practice for a column alias to be more than one word.

answered Sep 11, 2018 by CodingByHeart77
• 3,720 points

Related Questions In Database

0 votes
1 answer

Difference between clustered and non clustered index in SQL

The differences between the clustered and non ...READ MORE

answered Sep 28, 2018 in Database by Sahiti
• 6,360 points
839 views
0 votes
1 answer

What is the difference between HAVING and WHERE in SQL?

HAVING: It is used to check after the aggregation ...READ MORE

answered Feb 17 in Database by Vaani
• 5,040 points
31 views
0 votes
0 answers
+1 vote
3 answers

Difference between SQL and PL/SQL

In Oracle database administration, there are two ...READ MORE

answered Sep 25, 2019 in Database by gautham
686 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,630 points
854 views
0 votes
1 answer

Is SELECT * harmful in Database?

There are really three major reasons: Inefficiency in ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,240 points
348 views
0 votes
1 answer

Can different databases use different name quotes?

This use of quotes is called delimited ...READ MORE

answered Sep 11, 2018 in Database by CodingByHeart77
• 3,720 points
222 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
12,437 views
0 votes
2 answers

Difference between primary key a composite key

candidate  key: It is the collection of ...READ MORE

answered Oct 14, 2020 in Database by anonymous
22,926 views
0 votes
1 answer

Difference between STUFF & REPLACE function

STUFF Function: This function is used to ...READ MORE

answered Oct 10, 2018 in Database by CodingByHeart77
• 3,720 points
1,322 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP