Articles on Trending Technologies

Technical articles with clear explanations and examples

Show a MySQL user-defined variables values in the result table?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 229 Views

Use @ for variable and concat_ws() to display concatenated result in the table. Let us first create a table −mysql> create table DemoTable1508    -> (    -> StudentFirstName varchar(20),    -> StudentLastName varchar(20)    -> ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1508 values('Chris', 'Brown'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1508 values('David', 'Miller'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1508 values('John', 'Doe'); Query OK, 1 row affected (0.15 sec)Display all records from the table using select statement −mysql> ...

Read More

How to make MySQL display results in a single line?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 2K+ Views

For this, you can use group_concat(). Let us first create a table −mysql> create table DemoTable1507    -> (    -> Name varchar(20),    -> PaperSet int    -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1507 values('Chris', 111); Query OK, 1 row affected (0.37 sec) mysql> insert into DemoTable1507 values('David', 112); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1507 values('Mike', 111); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1507 values('Bob', 113); Query OK, 1 row affected (0.14 sec)Display all records from ...

Read More

How can I bind all events on a DOM element using jQuery?

Ricky Barnes
Ricky Barnes
Updated on 11-Dec-2019 758 Views

The bind( type, [data], fn ) method binds a handler to one or more events (like click) for each matched element. It can also bind custom events.Possible event values − blur, focus, load, resize, scroll, unload, click etc.Here is the description of all the parameters used by this method −type − One or more event types separated by a space.data − This is optional parameter and represents additional data passed to the event handler as event.data.fn − A function to bind to the event on each of the set of matched elements.ExampleYou can try to run the following code to learn how to ...

Read More

Remove space between two words in MySQL?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 393 Views

For this, you can use REPLACE(). Let us first create a table −mysql> create table DemoTable1506    -> (    -> Title text    -> ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1506 values('This is MySQL'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1506 values('This is Java language'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1506 values('This is MongoDB NoSQL database'); Query OK, 1 row affected (0.60 sec)Display all records from the table using select statement −mysql> select * from DemoTable1506;This will ...

Read More

How to check the element type of an event target with jQuery?

Ricky Barnes
Ricky Barnes
Updated on 11-Dec-2019 2K+ Views

To check the element type pf an event target, using the is() method.ExampleYou can try to run the following code to check the element type:Live Demo $(document).ready(function(){    $( "ul" ).click(function( event ) {       var target = $( event.target );       if ( target.is( "li" ) ) {          alert("Element is 'li'")       }   }); }); Click below to find out which element India US UK

Read More

How do I force the column alias to be of specific data type in MySQL?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 297 Views

For this, you can use CASE statement. Let us first create a table −mysql> create table DemoTable1505    -> (    -> Value integer unsigned,    -> Status tinyint(1)    -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1505 values(20, 0); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1505 values(45, 1); Query OK, 1 row affected (0.08 sec)Display all records from the table using select statement −mysql> select * from DemoTable1505;This will produce the following output −+-------+--------+ | Value | Status | +-------+--------+ |   ...

Read More

Swap a specific column value in MySQL

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 302 Views

Let us first create a table table −mysql> create table DemoTable1504    -> (    -> Id int,    -> FirstName varchar(20)    -> ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1504 values(101, 'Chris'); Query OK, 1 row affected (0.63 sec) mysql> insert into DemoTable1504 values(102, 'Bob'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable1504 values(103, 'David'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable1504 values(104, 'Mike'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement ...

Read More

Passing NULL to MySQL for auto increment?

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 910 Views

Yes, we can pass NULL as in the below syntax −insert into yourTableName values(NULL, yourValue1, yourValue2, ...N);Let us first create a table −mysql> create table DemoTable1503    -> (    -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> ClientName varchar(20),    -> ClientAge int    -> ); Query OK, 0 rows affected (0.45 sec)Insert some records in the table using insert command. Since we have set NOT NULL above, it won’t affect auto_increment −mysql> insert into DemoTable1503 values(NULL, 'Chris', 25); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1503 values(NULL, 'David', 28); Query OK, 1 row ...

Read More

Getting the Largest Window Height and Width of the Console in C#

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 273 Views

To get the largest window height of the Console, the code is as follows −Example Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("Largest Window Height of the Console = "+Console.LargestWindowHeight);    } }OutputThis will produce the following output −Largest Window Height of the Console = 58ExampleTo get the largest window width of the Console, the code is as follows − Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("Largest Window Width of the Console = "+Console.LargestWindowWidth);    } }OutputThis will produce the following output −Largest Window Width of the Console = 190

Read More

MySQL query for sorting on a columns partial value like number in “John_120 “

AmitDiwan
AmitDiwan
Updated on 11-Dec-2019 173 Views

For this, you can use SUBSTRING_INDEX() along with ORDER BY. Let us first create a table −mysql> create table DemoTable1502    -> (    -> StudentId varchar(40)    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1502 values('John_120'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable1502 values('John_201'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1502 values('Mike_178'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1502 values('Bob_198'); Query OK, 1 row affected (0.36 sec)Display all records from the table using select ...

Read More
Showing 52461–52470 of 61,248 articles
Advertisements