Insert Euro and Dollar Symbol to a Column in MySQL

AmitDiwan
Updated on 27-Dec-2019 06:15:28

1K+ Views

For this, use CASE statement with UPDATE command. Let us first create a table −mysql> create table DemoTable1874    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    Amount varchar(100) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1874(Amount) values('3450'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1874(Amount) values('190'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1874(Amount) values('7600'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1874(Amount) values('4500'); Query OK, 1 row affected (0.00 sec)Display all records ... Read More

Best Way to Update a Single Column in a MySQL Table

AmitDiwan
Updated on 27-Dec-2019 06:11:45

416 Views

To update a single column, use UPDATE and SET as in the below syntax −update yourTableName set yourColumnName=yourValue;Let us first create a table −mysql> create table DemoTable1873      (      Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,      FirstName varchar(20)      ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1873(FirstName) values('John'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1873(FirstName) values('Adam'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1873(FirstName) values('David'); Query OK, 1 row affected (0.00 sec) mysql> insert into ... Read More

MySQL Query to Select Rows with LIKE and Create New Column

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

291 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> insert into DemoTable1872 values('Adam Smith'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1872 values('Mitchell Johnson'); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1872;This will produce the following output −+------------------+ | Name         ... Read More

MySQL Datetime to Add Days

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

280 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 into DemoTable1871 values('2018-11-10 12:00:00'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1871 values('2019-01-31'); Query OK, 1 row affected (0.00 sec)Display all records from the table using select statement −mysql> select * from DemoTable1871; This will produce the following output −+---------------------+ | ArrivalDate         | ... Read More

Get First Date from Timestamp in MySQL Group By Another Column

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

304 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 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1870(Value, ShippingTimestamp) values(10, '1570645800'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1870(Value, ShippingTimestamp) values(10, '1546194600'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1870(Value, ShippingTimestamp) values(11, '1573324200'); Query OK, 1 row affected (0.00 ... Read More

Formatting Text Using CSS

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 alignment − Live Demo .demo {    -webkit-columns: auto auto; /* Chrome, Safari, Opera */    -moz-columns: auto auto; /* Firefox */    columns: auto auto;    text-align: justify; } Machine Learning Today’s Artificial Intelligence (AI) has far surpassed the hype of blockchain and ... Read More

Setting Text Color Using CSS

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

534 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 {    display: inline; } Match Details Match will begin at 9AM 10AM on 20th December. Match will end at 5PM on 20th December. OutputExampleLet us now see another example − Live Demo p.demo1 {    word-spacing: 1cm;    color: #F8E61C; } p.demo2 {    word-spacing: 40px; } Demo Heading Heading2 This is demo text. Heading2 This is demo text. Output

Letter Spacing Using CSS

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. OutputExampleLet us now see another example − Live Demo p.demo1 {    letter-spacing: 1cm; } p.demo2 {    letter-spacing: -2px; } Demo Heading Heading2 This is demo text. Heading2 This is demo text. Output

Generating Random String Using PHP

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

346 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

decbin Function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 10:38:57

116 Views

The decbin() function converts a decimal number to binary number.Syntaxdecbin(num)Parametersnum − Specifies a number to be converted to binary.ReturnThe decbin() function Returns a string representing the binary number of the decimal value.Example Live DemoOutput111100011001ExampleLet us see another example − Live DemoOutput1100011

Advertisements