- 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 6702 Articles for Database
380 Views
With the help of ‘mysqladmin’ program we would be able to know about the version of our MySQL server. To get the version we should have to write the following command on command line −C:\mysql\bin>mysqladmin -u root version mysqladmin Ver 8.42 Distrib 5.7.20, for Win64 on x86_64 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Server version 5.7.20 Protocol version 10 Connection localhost via TCP/IP TCP port ... Read More
261 Views
With the help of ‘mysqladmin’ program, we would be able to know whether our MySQLserver is alive or not. It can be used as follows on the command line −C:\mysql\bin>mysqladmin -u root ping mysqld is aliveThe message after running the command shows that our MySQL server is alive.
412 Views
There are following two methods to start MySQL server −Using Command LineWe need to run ‘mysqld’ program to run MySQL server. It can be started using the command line with the help of the following command −C:\mysql\bin>mysqldWe will see nothing after entering the ‘mysqld’ command because it will not print any message in the command window. We should have to trust that MySQL server is running now.Using file explorer windowWe can also start MySQL server by double-clicking the file \mysql\bin\mysqld.exe on our computer.
80 Views
As we know that, MySQL OCTET_LENGTH() function also measures the string length in ‘bytes’ hence, it is the synonym of MySQL LENGTH() function. The syntax of this function is OCTET_LENGTH(Str) where Str is a string whose length in characters has to be returned.It is also not multi-byte safe like LENGTH() function. For example, if a string contains four 2-bytes characters then OCTET_LENGTH() function will return 8. It is demonstrated in the example below −Examplemysql> Select OCTET_LENGTH('tutorialspoint'); +--------------------------------+ | OCTET_LENGTH('tutorialspoint') | +--------------------------------+ | 14 | +--------------------------------+ 1 ... Read More
119 Views
MySQL SUBSTRING_INDEX() function will return the same string as output if the argument ‘count’ has the value greater than the total number of occurrences of delimiter. It can be demonstrated with the following example −mysql> Select SUBSTRING_INDEX('www.google.co.in','.',4); +-------------------------------------------+ | SUBSTRING_INDEX('www.google.co.in','.',4) | +-------------------------------------------+ | www.google.co.in | +-------------------------------------------+ 1 row in set (0.00 sec)The above query returns the same string because 4 is greater than the total number of occurrences of delimiter provided as argument i.e. ‘.’.
116 Views
If we want to compare the data values of two columns then we need to provide the name of the columns as arguments of MySQL STRCMP() function. Suppose we have a table named ‘Marks’ which contains the name of the student and their secured marks in different subjects. Now, if we want to know that a particular student has got more or less or equal marks in two subjects then it can be illustrated using STRCMP() function as follows −Examplemysql> Select Name, STRCMP(Math, Hindi) from student marks WHERE Name = 'Rahul'; +-------+--------------------+ | Name | STRCMP(Math, Hindi) | +-------+--------------------+ | ... Read More
95 Views
For the purpose of comparison, we can use number values as an argument in STRCMP() function. They are given as arguments without quotes. Following example will demonstrate it.Examplemysql> Select STRCMP(10, 10)As 'Equal Numbers', STRCMP(11, 10)AS '2nd Smaller', STRCMP(10, 11)AS '1st Smaller', STRCMP(10, NULL)As '2nd NULL', STRCMP(NULL, 10)AS '1st NULL', STRCMP(NULL, NULL)AS 'Both NULL'; +---------------+-------------+-------------+----------+----------+-----------+ | Equal Numbers | 2nd Smaller | 1st Smaller | 2nd NULL | 1st NULL | Both NULL | +---------------+-------------+-------------+----------+----------+-----------+ | 0 | 1 | -1 | NULL | ... Read More
810 Views
Since we cannot use MINUS query in MySQL, we will use LEFT JOIN to simulate the MINUS query. It can be understood with the help of the following example:ExampleIn this example, we are two tables namely Student_detail and Student_info having the following data −mysql> Select * from Student_detail; +-----------+---------+------------+------------+ | studentid | Name | Address | Subject | +-----------+---------+------------+------------+ | 101 | YashPal | Amritsar | History | | 105 | Gaurav | Chandigarh | Literature | | 130 | Ram | Jhansi ... Read More
57 Views
Suppose we have the following table named ‘stock_item’ in which the column quantity is having duplicate values i.e. for item name ‘Notebooks’ and ‘Pencil’, the column ‘Quantity’ is having duplicate values ‘40’ as shown in the table.mysql> Select * from stock_item; +------------+----------+ | item_name |quantity | +------------+----------+ | Calculator | 89 | | Notebooks | 40 | | Pencil | 40 | | Pens | 32 | | Shirts | 29 | | Shoes | ... Read More
223 Views
In this case, SPACE() function would add white spaces depending upon the condition given in WHERE clause. The following example from student table will demonstrate it.Examplemysql> Select Id,Name,Space(5) from student WHERE Name='Harshit'; +------+---------+----------+ | Id | Name | Space(5) | +------+---------+----------+ | 15 | Harshit | | +------+---------+----------+ 1 row in set (0.00 sec)