- SQL - Discussion
- SQL - Useful Resources
- SQL - Useful Functions
- SQL - Quick Guide
- SQL - Questions and Answers
- SQL - Datatype Functions
- SQL - Conversion Functions
- SQL - JSON Functions
- SQL - Cursor Functions
- SQL - Logical Functions
- SQL - Statistical Functions
- SQL - Text & Image Functions
- SQL - Numeric Functions
- SQL - Aggregate Functions
- SQL - String Functions
- SQL - Date Functions
- SQL - Database Tuning
- SQL - IN vs EXISTS
- SQL - Group By vs Order By
- SQL - Common Table Expression
- SQL - Cursors
- SQL - Date & Time
- SQL - Auto Increment
- SQL - Using Sequences
- SQL - Handling Duplicates
- SQL - Sub Queries
- SQL - Transactions
- SQL - NULL Values
- SQL - Stored Procedures
- SQL - Default Constraint
- SQL - Check Constraint
- SQL - Null Functions
- SQL - Min & Max
- SQL - Hosting
- SQL - Injection
- SQL - Comments
- SQL - Wildcards
- SQL - Non-Clustered Index
- SQL - Clustered Index
- SQL - Unique Index
- SQL - Primary Key
- - 工会诉Join
- SQL - Inner Join
- SQL - Using Joins
- SQL - Aliases
- SQL - EXCEPT Operator
- SQL - INTERSECT Operator
- SQL - UNION vs UNION ALL
- SQL - UNION Operator
- SQL - BETWEEN Operator
- SQL - NOT NULL
- SQL - IS NOT NULL
- SQL - IS NULL
- SQL - NOT EQUAL
- SQL - NOT Operator
- SQL - CASE
- SQL - EXISTS Operator
- SQL - ANY, ALL Operators
- SQL - IN Operator
- SQL - LIKE Operator
- SQL - BOOLEAN (BIT) Operator
- SQL - AND & OR
- SQL - Having Clause
- SQL - Group By Clause
- SQL - Order By Clause
- SQL - Distinct Clause
- SQL - Top Clause
- SQL - Where Clause
- SQL - Rename Views
- SQL - Drop Views
- SQL - Update Views
- SQL - Create Views
- SQL - Sorting Results
- SQL - Delete Query
- SQL - Update Query
- SQL - Insert Into Select
- SQL - Select Into
- SQL - Select Query
- SQL - Insert Query
- SQL - Constraints
- SQL - Delete Table
- SQL - Drop Table
- SQL - Alter Tables
- SQL - Temporary Tables
- SQL - Clone Tables
- SQL - Truncate Table
- SQL - Rename Table
- SQL - Show Tables
- SQL - Create Table
- SQL - Backup Database
- SQL - Show Database
- SQL - Rename Database
- SQL - Select Database
- SQL - Drop Database
- SQL - Create Database
- SQL - Expressions
- SQL - Operators
- SQL - Data Types
- SQL - Syntax
- SQL - Databases
- SQL - RDBMS Concepts
- SQL - Overview
- SQL - Home
5. 图瓦卢
- 页: 1
- 页: 1
- 结构-创建指数
- 页: 1
- 页: 1
- 页: 1
- SQL - Foreign Key
- 文 件
- ∗ E/CN.6/2009/1。
- 页: 1
- 页: 1
- 文 件
- 页: 1
- 页: 1
- 文 件
- 页: 1
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SQL - Comments
In Programming, a comment is a technique to hide a pne of code from the compiler. It is also defined as an annotation and program-readable explanation of a computer program, added with the purpose of making the source code easier for humans to understand in a better way.
SQL-Comments
Comments are used to explain the section of the SQL statement; or to stop the execution of the statement. So, whenever a pne(s) of code is marked as a comment in a program, it is not executed.
Let us say we are performing a SQL query to display the contents of a table. But if the user does not understand the query, then we can utipze the comments to explain the idea or the query.
There are three types of comments in SQL, let’s see them in detail −
Single-pne comment.
Multi-pne comment.
In pne comment.
Single-pne comment
A single pne comment is one that ends in a single pne and begins with — (double hyphen), and the text after the — (double hyphen) is not executable.
Syntax
Following is the syntax of the single-pne comment.
--fetch all the table details --another comment. --SQL SELECT Query. SELECT * from table_name
Multi-pne comment
A multi-pne comment is a text that starts in one pne and ends in different pne, as well as text which is between these (/*…. */) symbols is known as multipne comment.
Syntax
Following is the syntax of the multi-pne comment.
/* this is first comment This is second comment Multi pne comment*/ SELECT * FROM table_name;
Inpne-comment
An inpne comment is the same as a multipne comment that is enclosed between /* and /*; but, an inpne comment is one that is present at the same pne where the SQL query is provided.
Syntax
Following is then syntax of the inpne comment.
SELECT * FROM table_name; /*customers*/
Example
In the following example, we define a SQL query that will create a table and display its contents, as well as provide all types of comments to explain the query in a better way.
--CREATING A TABLE CREATE TABLE Customerss(ID INT NOT NULL, NAME VARCHAR(50), AGE INT NOT NULL); /* INSERTING COLUMN S VALUE IN A TABLE NAMELY CUSTMERS */ INSERT INTO Customerss VALUES(01, Tutorialspoint , 10); INSERT INTO Customerss VALUES(02, Tutorix , 03); SELECT * FROM Customerss; /* DISPLAYING TABLE DETAILS */
When we run the above SQL query, we get the column values, however the comment pne is not executable, as we can see in the table below −
+----+----------------+-----+ | ID | NAME | AGE | +----+----------------+-----+ | 1 | Tutorialspoint | 10 | | 2 | Tutorix | 3 | +----+----------------+-----+Advertisements