AmitDiwan has Published 10744 Articles

MySQL query to SELECT rows with LIKE and create new column containing the matched string?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 06:09:28

289 Views

For this, use SUBSTRING(). Let us first create a table −mysql> create table DemoTable1872    (    Name varchar(20)    ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1872 values('John Doe'); Query OK, 1 row affected (0.00 sec) mysql> ... Read More

MySQL Datetime to add days?

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 06:05:40

274 Views

Let us first create a table −mysql> create table DemoTable1871      (      ArrivalDate datetime      ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1871 values('2019-12-19 7:45:00'); Query OK, 1 row affected (0.00 sec) mysql> insert ... Read More

Get first date from timestamp in MySQL group by another column with duplicate value

AmitDiwan

AmitDiwan

Updated on 27-Dec-2019 06:04:31

297 Views

For this, you can use aggregate function MIN() and GROUP BY. Let us first create a table −mysql> create table DemoTable1870      (      Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,      Value int,      ShippingTimestamp varchar(100)      ); Query OK, 0 rows affected (0.00 ... Read More

Formatting Text Using CSS

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 11:50:18

364 Views

To format text in CSS, you can change the text color, text decoration, line height, text direction, text alignment, etc.Let us see some examples −Text AlignmentTo set text alignment using CSS, use the text-align property. Following are the possible property values −text-align: left|right|center|justify|initial|inherit;ExampleLet us see an example to set text ... Read More

Setting Text Color using CSS

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 11:18:43

521 Views

To set the text color, use the color property in CSS. You can set the color with the color name, hexadecimal value, RGB value, or using the HSL value.Example Live Demo span {    background-color: orange;    color: white; } p.demo {    display: none; } span.demo1 { ... Read More

Letter Spacing using CSS

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 11:10:58

109 Views

To set space between letters i.e. characters, use the letter-spacing property. Following are the property values −letter-spacing: normal|length|initial|inherit;Example Live Demo p.demo1 {    letter-spacing: 1px; } p.demo2 {    letter-spacing: 10px; } Demo Heading Heading2 This is demo text. Heading2 This is demo text. ... Read More

Generating Random String Using PHP

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 10:39:42

338 Views

To generate random string using PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Displaying random string... 1c856ExampleLet us now see another example − Live DemoOutputThis will produce the following output−Displaying random string... a3541 Displaying another random string... 335b83d9e9

How to access an associative array by integer index in PHP?

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 10:37:25

473 Views

To access an associative array by integer index in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−Array key and value... key: p, value: 150 key: q, value: 100 key: r, value: 120 key: s, value: 110ExampleLet us now see another example− Live DemoOutputThis will produce the following ... Read More

How to check whether an array is empty using PHP?

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 10:34:39

182 Views

To check whether an array is empty, the code is as follows in PHP−Example Live Demo

How to create a copy of an object in PHP?

AmitDiwan

AmitDiwan

Updated on 26-Dec-2019 10:33:37

126 Views

To create a copy of an object in PHP, the code is as follows−Example Live DemoOutputThis will produce the following output−JackKevin TomRyanExampleLet us now see another example − Live DemoOutputThis will produce the following output−Demo Object(    [deptname] => Finance    [deptzone] => West ) Demo Object(    [deptname] => Finance    [deptzone] => West )

Advertisements