- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4378 Articles for MySQL
67 Views
Suppose if we do not want to execute a command that we are entering, then we can use a clear \c option which clears the current input. For example, the use of \c option can be done as follows −mysql> Select * -> from\cIn the example above, when we use \c in a statement, MySQL clears the current input and returns back to the MySQL prompt for accepting other statements.
567 Views
With the use of ego, \G option at end of a statement, we can get the result set in vertical format. Consider the following example −mysql> Select * from Student where name = 'Aarav'\G *************************** 1. row *************************** Name: Aarav RollNo: 150 Grade: M.SC 1 row in set (0.00 sec)
70 Views
MySQL determines the end of a statement when it encounters any one of the followings −Semicolon(;)Generally, MySQL determines the end of the statement, single-line or multiple-line, when it encounters the termination semicolon(;). Consider the examples below, mysql> Select * from employee; (Single line statement) mysql> Select * -> from -> employee; (Multiple line statement)In both cases, MySQL returns the result set after encountering the semicolon, which means the end of the statement.\G option\G option means to send the current state to the server to be executed and display the result in a vertical format. When we ... Read More
276 Views
With the help of \G or \g option just at the end of the MySQL statement, we can run it without the semicolon. Consider the example below −mysql> Select * from Stock_item\G *************************** 1. row *************************** item_name: Calculator Value: 15 Quantity: 89 *************************** 2. row *************************** item_name: Notebooks Value: 63 Quantity: 40 *************************** 3. row *************************** item_name: Pencil Value: 15 Quantity: 40 *************************** 4. row *************************** item_name: Pens Value : 65 Quantity: 32 *************************** 5. row *************************** item_name: Shirts Value: 13 Quantity: 29 *************************** 6. row *************************** item_name: Shoes ... Read More
264 Views
As we know that after writing the first line of multiple-line queries, MySQL changes the prompt. The following table shows different MySQL prompts and it's meaning −PromptMeaning mysql>It means MySQL is ready for a new command. →It means that MySQL is waiting for the next line of multiple-line command. ‘>It means that MySQL is waiting for the next line, waiting for the completion of a string that began with a single quote. “>It means that MySQL is waiting for the next line, waiting for the completion of a string that began with a double quote. `>It means that MySQL is waiting ... Read More
45 Views
After writing the first line of multiple-line queries, MySQL changes promptly from ‘mysql>’ to ‘→’. It is significant because with the help of it we got an indication that MySQL has not seen a complete statement yet and is waiting for the rest. Consider the example below,mysql> Select * -> from -> stock_item;We know that after writing the first line i.e. ‘Select *’ Mysql changes its prompts which means that yet the state has not been completed. After the semicolon, MySQL considers the statement completed and throws the output.
12K+ Views
Single Row Sub QueryA single-row subquery is used when the outer query's results are based on a single, unknown value. Although this query type is formally called "single-row, " the name implies that the query returns multiple columns-but only one row of results. However, a single-row subquery can return only one row of results consisting of only one column to the outer query.In the below SELECT query, inner MySQL returns only one row i.e. the minimum salary for the company. It, in turn, uses this value to compare the salary of all the employees and displays only those, whose salary ... Read More
114 Views
If a subquery is nested inside another subquery then it is called a nested subquery. To make it understand we are creating the nested subquery from the following tables data −mysql> Select * from Cars; +------+--------------+---------+ | ID | Name | Price | +------+--------------+---------+ | 1 | Nexa | 750000 | | 2 | Maruti Swift | 450000 | | 3 | BMW | 4450000 | | 4 | VOLVO | 2250000 | | 5 | Alto ... Read More
88 Views
If a subquery, used with EXIST operator, returns no rows, the expression EXIST returns FALSE and MySQL returns the empty set as output. It can be understood with the help of simple example using the following data from table ‘Customers’ −mysql> Select * from Customers; +-------------+----------+ | Customer_Id | Name | +-------------+----------+ | 1 | Rahul | | 2 | Yashpal | | 3 | Gaurav | | 4 | Virender | +-------------+----------+ 4 rows in ... Read More
359 Views
If a subquery, used with EXIST operator, returns NULL, the expression EXIST NULL returns TRUE and MySQL returns the result based on an outer query. It can be understood with the help of simple example using the following data from table ‘Customers’ −mysql> Select * from Customers; +-------------+----------+ | Customer_Id | Name | +-------------+----------+ | 1 | Rahul | | 2 | Yashpal | | 3 | Gaurav | | 4 | Virender | +-------------+----------+ 4 rows in ... Read More