Rama Giri has Published 110 Articles

Select dates between current date and 3 months from the current date in MySQL?

Rama Giri

Rama Giri

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

1K+ Views

Use BETWEEN and INTERVAL to achieve this. Let us first create a table −mysql> create table DemoTable    -> (    -> AdmissionDate date    -> ); Query OK, 0 rows affected (0.84 sec)Insert some records in the table using insert command −mysql> insert into DemoTable  values('2019-09-30'); Query OK, 1 ... Read More

GROUP BY and display only non-empty column values in MySQL

Rama Giri

Rama Giri

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

937 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> Id varchar(100),    -> Message varchar(200)    -> ); Query OK, 0 rows affected (1.17 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('1', ''); Query OK, 1 row affected ... Read More

How to show Alert Dialog in iOS?

Rama Giri

Rama Giri

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

1K+ Views

Knowing how to play with Alert is very important if you’re designing any iOS Application. Here we will be focusing on how to show Alert using UIAlertController.To read more about UIAlertController refer −  https://developer.apple.com/documentation/uikit/uialertcontrollerIn this, we will be creating a new project where we will have a button, on tapping ... Read More

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

3K+ 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

1K+ 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

209 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

413 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

79 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

Advertisements