Split Left Part of String by Separator in MySQL

Chandu yadav
Updated on 30-Jul-2019 22:30:24

497 Views

You can use substring_index() function from MySQL to split the left part of a string. The syntax is as follows −SELECT yourColumnName1, .....N, SUBSTRING_INDEX(yourColumnName, ’yourSeperatorSymbol’, 1) as anyVariableName from yourTableName;The value 1 indicates that you can get left part of string. To check the above syntax, let us create a table. The query to create a table is as follows −mysql> create table LeftStringDemo -> ( -> Id int, -> Words varchar(100) -> ); Query OK, 0 rows affected (0.92 sec)Insert some records in the table using insert ... Read More

Different Types of Eclipses

Knowledge base
Updated on 30-Jul-2019 22:30:24

1K+ Views

An Eclipse is formed when a celestial body is obscured by another. We know that eclipses occur when sun, moon, and earth align in a straight line. The Solar eclipse occurs when the moon comes in between the sun and the earth. The Lunar eclipse is formed when the earth blocks the way for the sunlight to reach the moon.Penumbra and AntumbraThe umbra is the innermost and darkest part of the shadow, which is the area when an observer can experience the eclipse completely. The Penumbra is the area in which only a portion of the light is obscured by ... Read More

FTP Site Function in PHP

Samual Sam
Updated on 30-Jul-2019 22:30:24

76 Views

The ftp_site() function sends an FTP SITE command to the FTP server.Syntaxftp_site(conn,command);Parametersconn − The FTP connectioncommand − The SITE command. These commands vary from server to server and used in handling OS specific features such as file permissions and group membership.ReturnThe ftp_site() function returns TRUE on success or FALSE on failure.ExampleThe following is an example −

Can MySQL Automatically Convert Empty Strings to NULL

George John
Updated on 30-Jul-2019 22:30:24

15K+ Views

You need to use NULLIF() function from MySQL. The syntax is as follows:SELECT NULLIF(yourCoumnName, ’ ’) as anyVariableName from yourTableName;In the above syntax, if you compare empty string( ‘ ‘) to empty string( ‘ ‘), the result will always be NULL. However, if you compare with NULL to empty string( ‘ ‘) then also the result will always be NULL.To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ConvertEmptyStringToNULL    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(20),    -> PRIMARY KEY(Id)   ... Read More

Multiply One BigDecimal to Another BigDecimal in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

2K+ Views

Use the multiply() method to multiply one BigDecimal to another in Java. This method returns a BigDecimal whose value is (this × multiplicand), and whose scale is (this.scale() + multiplicand.scale()).The following is an example −Example Live Demoimport java.math.BigDecimal; public class Demo { public static void main(String[] argv) throws Exception { BigDecimal val1 = new BigDecimal("375789755.345778656"); BigDecimal val2 = new BigDecimal("525678755.155778656"); System.out.println("Value 1 = "+val1); System.out.println("Value 2 = "+val2); ... Read More

What is Human Resource Management

Rashmi Iyer
Updated on 30-Jul-2019 22:30:24

470 Views

Human Resource Management (HRM) is a discipline in the broad dimension of management where the study of practices that influences and affects people who work in an organization is conducted. It facilitates the coordination of the Human resource, who are the most important part of an organization.Developing the skills of the personnel, providing the personnel with the necessary training, giving them continuous motivation are all part of Human Resource Management. HRM is a relatively new discipline which brings fresh perspectives and outlook in an organization because it considers manpower as an asset of the organization.In the era of the Industrial ... Read More

Count Distinct Values in MySQL

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

8K+ Views

To count distinct values, you can use distinct in aggregate function count().The syntax is as follows −select count(distinct yourColumnName) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The following is the query to create a table −mysql> create table DistinctDemo −> ( −> Name varchar(200) −> ); Query OK, 0 rows affected (0.58 sec)For our example, let us insert duplicate records in the table. The query to insert records is as follows −mysql> insert into DistinctDemo values('John'); Query OK, 1 row affected (0.15 sec) mysql> ... Read More

Difference Between INT and INTEGER in MySQL

George John
Updated on 30-Jul-2019 22:30:24

2K+ Views

The int is the synonym of integer in MySQL 5.0. Here is the demo display both int and integer internally represents int(11).Creating a table with int datatypemysql> create table IntDemo    -> (    -> Id int    -> ); Query OK, 0 rows affected (1.04 sec)Here is description of the table. The query is as followsmysql> desc IntDemo;The following is the output+-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | Id    | int(11) | YES  |     | NULL    |       | +-------+---------+------+-----+---------+-------+ 1 row in ... Read More

Best Use of a Smartphone

Madhuparna
Updated on 30-Jul-2019 22:30:24

161 Views

A smartphone is the most common device often seen in the hands of people, starting from the small kids to a 60 years old man. What is so special about this gadget? Does it only make life easier? What are the additional benefits this gadget offers? Numerous questions come to the mind of the users when they are buying the smart phone for the first time.For some folks, these gadgets are nothing but an instrument of entertainment. For some, it is the way to communicate to people around the world; some use it as the camera, whereas some may use ... Read More

FTP Size Function in PHP

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

87 Views

The ftp_size() function is used to get the size of a particular file on the FTP server.Syntaxftp_size(conn, myfile)Parametersconn − The FTP connectionmyfile − The server fileReturnThe ftp_size() function returns the size of the particular file in bytes on success.ExampleThe following is an example to get the size of file “new.txt” −

Advertisements