Ad Code

Responsive Advertisement

Ticker

6/recent/ticker-posts

SQL Query to Find the Daily Users Registered

 Finding the Daily Users Registered


Consider the below table for example:

Query to create the table: 

-- create a table

CREATE TABLE students (

  id INTEGER PRIMARY KEY,

  name TEXT NOT NULL,

  gender TEXT NOT NULL,

  date TEXT not null

);

-- insert some values

INSERT INTO students VALUES (1, 'Ryan', 'M', '28/10/2022');

INSERT INTO students VALUES (2, 'Joanna', 'F', '29/10/2022');

INSERT INTO students VALUES (3, 'Mick', 'M', '30/10/2022');

INSERT INTO students VALUES (4, 'Jonas', 'M', '30/10/2022');

-- fetch some values

SELECT * FROM students;


Output:

As you can see in the above table we are having four columns Id, Name, Gender and Date Registered.


Below is the simple query to find the Daily Users Registered:

SELECT date AS num, COUNT(*) AS date FROM students GROUP BY date;


Output:



Explanation:

As you can see below we are having Ryan and Joanna registered on "28/10/2022" and "29/10/2022", and the users Mick and Jonas are registered on the same date: "30/10/2022".

Thus, in the above output, we are having 1 user registered on "28/10/2022" and another 1 user on "29/10/2022" and last we are having two users registered on "30/10/2022". Thus, in this way you can get the Daily Users Registered in SQL.


Thanks for reading...

Post a Comment

0 Comments

Ad Code

Responsive Advertisement