MySQL Order By ASC and Display NULLs at the Bottom

AmitDiwan
Updated on 30-Dec-2019 07:54:41

564 Views

For this, use CASE statement with ORDER BY. Let us first create a table −mysql> create table DemoTable1937    (    Name varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1937 values('Chris'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1937 values(NULL); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1937 values('Adam'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1937 values('John'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1937 values(''); Query OK, 1 row affected (0.00 sec) ... Read More

Perform Multiple Inserts with INSERT INTO SELECT and UNION in MySQL

AmitDiwan
Updated on 30-Dec-2019 07:51:53

3K+ Views

To perform multiple inserts, the syntax is as follows −insert into yourTableName(yourColumnName1, yourColumnName2, yourColumnName3, ..N)    select yourValue1 as yourColumnName1, yourValue2 as yourColumnName2, yourValue3 as yourColumnName3, ......N    union    select yourValue1 as yourColumnName1, yourValue2 as yourColumnName2, yourValue3 as yourColumnName3, ......N . . NTo understand the above syntax, let us create a table −mysql> create table DemoTable1936    (    StudentId int,    StudentName varchar(20),    StudentCountryName varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1936(StudentId, StudentName, StudentCountryName)    select 1001 as StudentId, 'Chris' as StudentName, 'US' ... Read More

intlchar_isbase Function in PHP

karthikeya Boyini
Updated on 30-Dec-2019 07:50:46

106 Views

The IntlChar::isbase() function is used to check the given input data is a base character or not.SyntaxIntlChar::isbase( val)Parametersval − An integer or character encoded as a UTF-8 string. Required.ReturnThe IntlChar::isbase() function returns TRUE if the val is a base character.ExampleThe following is an example −OutputThe following is the output −bool(true) NULL NULL NULL

Check If a String Ends with Given Word in PHP

Samual Sam
Updated on 30-Dec-2019 07:50:17

535 Views

Create a function to check whether a string ends with the specified string or not. The function should return TRUE on success or FALSE on failure.The following is the syntax −endFunc(str, lastStr)Consider the following parameters in it to check −str − The string to be testedlastStr − The text to be searched in the end of the specified string.ExampleThe following is an example − Live DemoOutputThe following is the output −False!

intlchar_isalpha Function in PHP

karthikeya Boyini
Updated on 30-Dec-2019 07:49:49

367 Views

The IntlChar::isalpha() function is used to check the given input is an alphanumeric character or not.SyntaxIntlChar::isalpha( $val )Parametersval − An integer values or character encoded as a UTF-8 string.Required.ReturnThe IntlChar::isalpha() function returns TRUE if the val is alphanumeric character.ExampleThe following is an example −OutputThe following is the output −bool(false) bool(true)ExampleLet us see another example wherein we are checking for alphanumeric characters −OutputThe following is the output −NULL NULL NULL bool(true)

intlchar_isUppercase Function in PHP

Samual Sam
Updated on 30-Dec-2019 07:49:14

119 Views

The IntlChar::isUUppercase() function checks whether the given input character is an Uppercase Unicode character or not.SyntaxIntlChar::isUUppercase(val)Parametersval − It is a character value, which is encoded as a UTF-8 string.ReturnThe IntlChar::isUUppercase() function returns TRUE if the val is an Uppercase Unicode character or not.ExampleThe following is an example −OutputThe following is the output −bool(false) NULL bool(true)ExampleLet us see another example −OutputThe following is the output −bool(false) bool(false) bool(true)

MySQL Query to Display Records Using LIKE with Multiple Words

AmitDiwan
Updated on 30-Dec-2019 07:49:12

334 Views

For this, use RLIKE and filter records as in the below syntax &Minus;select * from yourTableName    where yourColumnName rlike 'yourValue1|yourValue2';Let us first create a table −mysql> create table DemoTable1935    (    Subject varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1935 values('MySQL'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1935 values('Python'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1935 values('MongoDB'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1935 values('SQL Server'); Query OK, 1 row affected (0.00 ... Read More

intlchar_ispunct Function in PHP

karthikeya Boyini
Updated on 30-Dec-2019 07:48:40

124 Views

The IntlChar::ispunct() function check whether the given input character is a punctuation character or not.Syntaxbool IntlChar::ispunct(val)Parametersval − An integer value or character encoded as a UTF-8 string. Required!ReturnThe IntlChar::ispunct()function returns TRUE if the val is a punctuation character.ExampleThe following is an example −OutputThe following is the output −bool(false) bool(true) bool(false)ExampleLet us see another example −OutputThe following is the output −bool(true) bool(true) NULL

jQuery hasClass Method with Examples

AmitDiwan
Updated on 30-Dec-2019 07:48:11

280 Views

The hasClass() method in jQuery is used to check if any of the selected elements is having a specified class name.SyntaxThe syntax is as follows −$(selector).hasClass(classname)Above, the parameter class name is the class name to search for in the selected elements.ExampleLet us now see an example to implement the jQuery hasClass() method− Live Demo    $(document).ready(function(){       $("button").click(function(){          alert($("h2").hasClass("demo"));       });    }); Student Info Teacher Info Click me OutputThis will produce the following output− Click the “Click me” button to display whether any element has class “demo”: 

intlchar_isSpace Function in PHP

Samual Sam
Updated on 30-Dec-2019 07:47:57

165 Views

The IntlChar::isspace() function check whether the given input character is a space character or not.SyntaxIntlChar::isspace(val)Parametersval − An integer value or character encoded as UTF-8 string.ReturnThe IntlChar::isspace()function returnsTRUE if the val is a space character.ExampleThe following is an example −OutputThe following is the output −NULL bool(true) bool(true)ExampleLet us see another example −OutputThe following is the output −NULL bool(true) bool(false)

Advertisements