Rama Giri has Published 107 Articles

How to Set opacity for View in iOS?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

1K+ Views

View’s Alpha value is a floating-point number in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque. Changing the value of this property updates the alpha value of the current view only.You can simply adjust alpha value based on the opacity you want.Write the following line in you viewDidLoad methodview.backgroundColor ... Read More

MySQL query to get the count of values and display the count in a new column ordered in descending order

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

4K+ Views

Use ORDER BY with DESC to order in descending order. For counting the values, use the COUNT(). For example, if the name “John” appears thrice in the column, then a separate column will display the count 3 and in this way all the count values will be arranged in descending ... Read More

How to place a thousand separator in MySQL records?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

2K+ Views

Use the FORMAT() method for this. Let us first create a table −mysql> create table DemoTable    -> (    -> Amount DECIMAL(10, 2)    -> ); Query OK, 0 rows affected (0.45 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(84848757.60); Query OK, 1 ... Read More

How do I display the current date and time in an iOS application?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

263 Views

Playing with date and time is very important in any programming language, it becomes more important if you’re developing mobile application.Numerous application such as weather, forecast, gaming and so on uses date and time. In this we will be seeing how we can get the current date and time.To get ... Read More

What is the most efficient way to select a specific number of random rows in MySQL?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

476 Views

Use RAND() method for random and to limit a number of records, use the LIMIT() method in MySQL.Let us first create a table −mysql> create table DemoTable    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using ... Read More

How to update a timestamp field of a MySQL table?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

2K+ Views

Let us first create a table −mysql> create table DemoTable    -> (    -> PunchOut timestamp,    -> PunchStatus tinyint(1)    -> ); Query OK,  0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-31 6:30:10', 1); Query OK,  1 row affected (0.22 sec) mysql> insert into DemoTable values('2019-02-06 4:10:13', 0); Query OK,  1 row affected (0.14 sec) mysql> insert into DemoTable values('2018-12-16 03:00:30', 0); Query OK,  1 row affected (0.16 sec) mysql> insert into DemoTable values('2016-11-25 02:10:00', ... Read More

Finding a specific row which has several ids separated by comma in MySQL?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

125 Views

To find a row, use FIND_IN_SET(). Let us first create a table −mysql> create table DemoTable    -> (    -> ListOfIds varchar(200)    -> ); Query OK, 0 rows affected (0.72 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('100, 2093, 678, 686'); Query ... Read More

MySQL select any one field out of two with respect to the value of a third field?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:26

72 Views

For this, use IF(). Let us first create a table −mysql> create table DemoTable    -> (    -> PlayerName varchar(100),    -> PlayerScore int,    -> PlayerStatus varchar(100)    -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

Deleting the nth row in MySQL?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:25

938 Views

To delete nth row in MySQL, use DELETE statement and work with subquery. Let us first create a table:mysql> create table DemoTable1    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(100)    -> ); Query OK, 0 rows affected (0.99 sec)Following is the ... Read More

How to work with array variable in MySQL?

Rama Giri

Rama Giri

Updated on 30-Jul-2019 22:30:25

2K+ Views

MySQL does not support array variables. To get the same result, use the table DUAL. Following is the syntax:SELECT yourValue1 AS ArrayValue FROM DUAL UNION ALL SELECT yourValue2 FROM DUAL UNION ALL SELECT yourValue3 FROM DUAL UNION ALL SELECT yourValue4 FROM DUAL UNION ALL . . . . . . ... Read More

Advertisements