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 darklord
• 6,140 points
43 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,680 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 darklord
• 6,140 points
40 views
0 votes
1 answer

Difference between SQL and PL/SQL

SQL is a query language that allows ...READ MORE

answered Oct 15, 2018 in Database by DataKing99
• 8,100 points
98 views
0 votes
1 answer

STUFF and REPLACE function in SQL

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

answered Sep 27, 2018 in Database by DataKing99
• 8,100 points
33 views
0 votes
1 answer

Difference between cross join and natural join

The cross join produces the cross product ...READ MORE

answered Oct 12, 2018 in Database by DataKing99
• 8,100 points
787 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 parth295
• 4,590 points
87 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,100 points
19 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,680 points
22 views
0 votes
1 answer

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

To display the name of the employees ...READ MORE

answered Sep 26, 2018 in Database by darklord
• 6,140 points
25 views
0 votes
1 answer

Difference between primary key a composite key

Primary key is that column of the table ...READ MORE

answered Sep 5, 2018 in Database by CodingByHeart77
• 3,680 points
729 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,680 points
28 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.