Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

MySQL Interview Questions and Answers

Ques 61. How To Include Comments in SQL Statements?

Ans. If you want to include comments in a SQL statement, you can first enter "--", then enter your comment until the end of the line. The tutorial exercise below shows you some good examples:

SELECT 'Hello world!' FROM DUAL; -- My first SQL statement!

INSERT INTO links VALUES ('GlobalGuideLine.com'); -- Top rated!

CREATE TABLE faq (
id INTEGER, -- primary key
title VARCHAR(80) -- FAQ title
);

Is it helpful? Add Comment View Comments
Ques 62. How To Include Character Strings in SQL statements?
Ans. If you want to include character strings in your SQL statements, you need to quote them in one of the following formats:

► Using single quotes. For example 'GlobalGuideLine.com'.
► Using double quotes. For example "ggl Center".
► Using single quotes prefixed with N for NATIONAL characters (same as UTF8 characters). For example N'Allo, Francois.'.
► Using single quotes prefixed with _utf8 for UTF8 characters. For example _utf8'Allo, Francois.'.
Is it helpful? Add Comment View Comments
Ques 63. How To Escape Special Characters in SQL statements?
Ans. There are a number of special characters that needs to be escaped (protected), if you want to include them in a character string. Here are some basic character escaping rules:

► The escape character () needs to be escaped as (\).
► The single quote (') needs to be escaped as (') or ('') in single-quote quoted strings.
► The double quote (") needs to be escaped as (") or ("") in double-quote quoted strings.
► The wild card character for a single character (_) needs to be escaped as (_).
► The wild card character for multiple characters (%) needs to be escaped as (%).
► The tab character needs to be escaped as (t).
► The new line character needs to be escaped as (n).
► The carriage return character needs to be escaped as (r).

Here are some examples of how to include special characters:

SELECT 'It''s Sunday!' FROM DUAL;
It's Sunday!

SELECT 'Allo, C'est moi.' FROM DUAL; Allo, C'est moi.

SELECT 'MontTuetWedtThutFri' FROM DUAL;
Mon Tue Wed Thu Fri
Is it helpful? Add Comment View Comments
Ques 64. How To Concatenate Two Character Strings?
Ans. If you want concatenate multiple character strings into one, you need to use the CONCAT() function. Here are some good examples:
SELECT CONCAT('Welcome',' to') FROM DUAL;
Welcome to

SELECT CONCAT('wb','center','.com') FROM DUAL;
WithoutBook.com
Is it helpful? Add Comment View Comments
Ques 65. How To Include Numeric Values in SQL statements?
Ans. If you want to include a numeric value in your SQL statement, you can enter it directly as shown in the following examples:

SELECT 255 FROM DUAL; -- An integer
255

SELECT -6.34 FROM DUAL; -- A regular number
-6.34

SELECT -32032.6809e+10 FROM DUAL; -- A floating-point value
-3.20326809e+014
Is it helpful? Add Comment View Comments

Most helpful rated by users:

©2020 WithoutBook