Chandu yadav has Published 1165 Articles

Get table names using SELECT statement in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

6K+ Views

To get table names using SELECT statement, use “information_schema.tables”. Let us see an example, wherein we have a database that contains 3 tables. The syntax to get all table names with the help of SELECT statement. SELECT Table_name as TablesName from information_schema.tables where table_schema = 'yourDatabaseName'; Using database ... Read More

What data type to use for hashed password field in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

5K+ Views

The hashed password data type depends upon which hashing algorithm we are using. The hashing algorithm does not depends upon the input size because it produces a result of the same length. It gives the result in a series of hexadecimal digits, and we can reduce the hexadecimal digits by ... Read More

How long is the SHA256 hash in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

2K+ Views

As the name “SHA256” suggest, it is 256 bits long. If we are using hexadecimal notation then digit codes represent 4 bits. In order to represent 256, we need 256/4 = 64 bits. We need a data type varchar(64) or char(64). Creating a table for our example. mysql> create ... Read More

Add 2 hours to current time in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

8K+ Views

We can get the current time with the help of now() and adding 2 hours is done by giving the interval as 2. Firstly, collect information of the current time in the system with the help of now(). The current time is . The following is the query to ... Read More

How does “do something OR DIE()” work in Perl?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

3K+ Views

The die() function can be used to stop the script and can be used to display a message to the end user. It can be used at the right side of the OR ( || ) operator and at left side can be any expression like the eval() function. Case ... Read More

How to raise an error within MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

2K+ Views

MySQL has introduced signals similar to an exception in other languages. Let us first see the syntax of signal. SIGNAL SQLSTATE ' PredefinedValueforSignalError' SET MESSAGE_TEXT = 'AnyMessageInformation'; Above, we have set our own error message text as well. We will apply the above query to get an ... Read More

What is the difference between initialization and assignment of values in C#?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

852 Views

Let us understand the difference between initialization and assignment of values. Declaring an array. int [] n // declaring Initialization Declaring an array does not initialize the array in the memory. When the array variable is initialized, you can assign values to the array. Array is ... Read More

MySQL ON vs USING?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

5K+ Views

In general, we use ON in MySQL. In Joins, we use ON in a set of columns. USING is useful when both the tables share a column of the exact same name on which they join. Example of On. Creating our first table. mysql> CREATE table ForeignTableDemo ... Read More

What is the MySQL JDBC driver connection string?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

343 Views

The MySQL JDBC connection string look like this − Class.forName("com.mysql.jdbc.Driver"); Above, Driver is an interface. Whenever your JDBC is running outside an application server, then the class DriverManager establish the connection. The DriverManager class is as follows − conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/yourdatabaseName", ”yourRootName", "yourPassword"); Now, I ... Read More

Count the number of occurrences of a string in a VARCHAR field in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jul-2019 22:30:23

4K+ Views

To count the number of occurrences of a string in a VARCHAR, we can use the logic of subtraction with length. First, we will create a table with the help of create command. mysql> create table StringOccurrenceDemo -> ( -> Cases varchar(100), ... Read More

Advertisements