MySQL query to group data in the form of user login time per hour and get the records of the users logged in the recent hour?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

374 Views

You can use a subquery with JOIN condition for this. The syntax is as follows −SELECT yourTablevariableName.* FROM ( SELECT MAX(UNIX_TIMESTAMP(yourDateTimeColumnName)) AS anyAliasName FROM getLatestHour GROUP BY HOUR(UserLoginDateTime) ) yourOuterVariableName JOIN yourTableName yourTablevariableName ON UNIX_TIMESTAMP(yourDateTimeColumnName) = yourOuterVariableName.yourAliasName WHERE DATE(yourDateTimeColumnName) = 'yourDateValue';To understand the above syntax and the result to be achieved, let us create a table. The query to create a table is as follows −mysql> create table getLatestHour -> ( -> UserId int, -> UserName varchar(20), -> UserLoginDateTime ... Read More

What is the MySQL error: "Data too long for column"?

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

22K+ Views

The “Data too long for column” error occurs when you insert more data for a column that does not have the capability to store that data.For Example - If you have data type of varchar(6) that means it stores only 6 characters. Therefore, if you will give more than 6 characters, then it will give an error.Let us create a table to understand the error. The query to create a table is as follows −mysql> create table DataToolongDemo   −> (   −> Name varchar(10) −> ); Query OK, 0 rows affected (0.55 sec)Above, we have created a table ... Read More

Who was the first person on Earth according to Hindu mythology?

Knowledge base
Updated on 30-Jul-2019 22:30:24

20K+ Views

According to Matsyapurana, the first person on this Earth is Manu. The Sanskrit term Maanav meaning a human was derived from the name Manu denoting his children. Manu was the son of Prajapati (another name of Brahma) and Shatrupa (another name of Saraswati). God created Ananti as the wife of Manu. These two are said to be the parents of this world according to Hindu Mythology.Manu and ManvantaraManu is considered the author of ancient Sanskrit code of law called Manu Smriti. Manu is the head of each Kalpa (Aeon), which consists of fourteen Manvantaraas. Each Manvantara lasts for the lifetime ... Read More

How to set target and action for UIBarButtonItem at runtime?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

1K+ Views

To create a bar button action at run time we’ll need to go through a few steps. First of all let’s start by creating a new project.Once you have created the project, go to it’s storyboard directly, select the ViewController and Embed it into a navigation controller.Now go to the respective View controller class and inside it, we’ll perform some steps that will add a button to the navigation bar on run time.Create an objc function that should be called when the button is pressed.@objc func barButtonAction() {    print("Button pressed") }Now add the viewWillLayoutSubviews method to your class.First, we’ll ... Read More

8085 program to find larger of two 8 bit numbers

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:24

4K+ Views

In this program we will see how to find the larger of two numbers.Problem StatementWrite 8085 Assembly language program to find the larger number of two 8-bit number store dat location 8000H and 8001H.DiscussionThis checking is done by using the CMP instruction. This instruction is very similar to the SUB instruction. The only difference is that it does not update the value of Accumulator after executing. So after comparing, if the CY flag is set, it means that the first number is smaller, and the second one is largerInputFirst inputAddressData......8000FD800123......second inputAddressData......800059800175......Flow DiagramProgramAddressHEX CodesLabelMnemonicsCommentsF00021, 00, 80LXI H, 8000HPoint to the first ... Read More

Check if string contains another string in Swift

Samual Sam
Updated on 30-Jul-2019 22:30:24

461 Views

To check if a string contains another string in swift, we’ll need two different strings. One string that we have to check if it consists another string.Let us say the string we want to check is “point” and the whole string is “TutorialsPoint” and another string is “one two three”. Let’s check with both these string in the playground.We can do this in two ways as shown below. Let’s start by creating three different strings.var CompleteStr1 = "Tutorials point" var completeStr2 = "one two three" var stringToCheck = "point"Method OneIn this method we’ll use the .contains method of Strings to ... Read More

What are top 10 Virtual Reality (VR) Games?

Diler Singh
Updated on 30-Jul-2019 22:30:24

331 Views

The concept of Virtual Reality is surely an awe-inspiring experience, but tell me to how many is it accessible? From both cost and usability point of view, this technology is still in its halfway to reach to the masses. However, the VR games market is glutted with a number of VR games. Moreover, they are developing native VR experiences that cash in on the medium, with games leading the way. Thus, the VR fans have a lot of choices to make and this roundup will surely draw their attention.Robo Recall (Oculus Rift Exclusive)Beat Saber (Multiplatform)Skyrim VRSprint VectorFallout 4Lone EchoEVE: ValkyrieFarpointMinecraft ... Read More

MySQL GROUP BY with WHERE clause and condition count greater than 1?

Samual Sam
Updated on 30-Jul-2019 22:30:24

2K+ Views

To understand the group by with where clause, let us create a table. The query to create a table is as follows −mysql> create table GroupByWithWhereClause    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> IsDeleted tinyint(1),    -> MoneyStatus varchar(20),    -> UserId int,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.57 sec)Now you can insert some records in the table using insert command. The query is as follows −mysql> insert into GroupByWithWhereClause(IsDeleted, MoneyStatus, UserId) values(0, 'Undone', 101); Query OK, 1 row affected (0.17 sec) mysql> insert into GroupByWithWhereClause(IsDeleted, MoneyStatus, UserId) ... Read More

Can I change the size of UIActivityIndicator in Swift?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

869 Views

It is possible to change the size of UIActivityIndicator in swift using some tricks but it’s not recommended to change the size. To change the size of activity indicator let’s first add an indicator on an empty screen and see how it looks. For this example, I’ll also change the color to red.Let’s see how it looks when we run it without changing the size of the indicator.Now, we’ll create an outlet of activity indicator in our view controller and in the viewDidLoad method of this class we’ll add the code below.We’ll use CGAffineTransform to change the scale of our ... Read More

Find lowest Date (custom) in MySQL?

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

356 Views

To find lowest Date(custom) in MySQL, let us first create a table. The query to create a table is as follows:mysql> create table FindMinimumDate    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> yourDay varchar(2),    -> yourMonth varchar(2),    -> yourYear varchar(4),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command. The query is as follows:mysql> insert into FindMinimumDate(yourDay, yourMonth, yourYear) values('21', '11', '2019'); Query OK, 1 row affected (0.10 sec) mysql> insert into FindMinimumDate(yourDay, yourMonth, yourYear) values('20', '10', '2020'); Query OK, ... Read More

Advertisements