MySQL 2022-08-12 11:49

|
surendra reigns 2022-08-12 11:49:39
Then what should we do sir
surendra reigns 2022-08-12 11:51:48
There is no booking date and amount sir
Swapnil 2022-08-12 11:52:21
create table booking (booking_id varchar, booking_date date,amount int,emp_id varchar);

create table employees (emp_id varchar, emp_name varchar);

insert into booking values (‘b_1′,’1/1/2021′,100, ’emp_1′);
insert into booking values (‘b_2′,’1/1/2021′,200, ’emp_1′);
insert into booking values (‘b_3′,’1/3/2021′,300, ’emp_1′);
insert into booking values (‘b_8′,’1/4/2021′,1000, ’emp_2′);
insert into booking values (‘b_9′,’2/5/2021′,2000, ’emp_2′);

insert into employees values (’emp_1′,’Mohsin’);
insert into employees values (’emp_2′,’Jaskaran’);

with booking_info as
(
select b.*,
row_number () over (partition by b.emp_id order by booking_date) as rn
from booking b
),
min_max_info as
(
select emp_id,min(rn) as min_rn, max(rn) as max_rn
from booking_info
group by emp_id
),
min_date as
(
select bi.emp_id, bi.booking_date, amount
from booking_info bi
join min_max_info mmi_min on bi.emp_id = mmi_min.emp_id and bi.rn = mmi_min.min_rn
),
max_date as
(
select bi.emp_id, bi.booking_date, amount
from booking_info bi
join min_max_info mmi_max on bi.emp_id = mmi_max.emp_id and bi.rn = mmi_max.max_rn
)
select
e.emp_name,
min_date.booking_date as first_booking_date,
max_date.booking_date as last_booking_date,
min_date.amount+max_date.amount as Total_booking_amount,
(min_date.amount+max_date.amount)/2 as avg_Sales_amount
from min_date
join max_date on min_date.emp_id = max_date.emp_id
join employees e on min_date.emp_id = e.emp_id

Output:
emp_name | first_booking_date | last_booking_date | total_booking_amount | avg_sales_amount
———-+——————–+——————-+———————-+——————
Mohsin | 2021-01-01 | 2021-01-03 | 400 | 200
Jaskaran | 2021-01-04 | 2021-02-05 | 3000 | 1500

Swapnil 2022-08-12 12:09:57
Last warning to you
surendra reigns 2022-08-12 12:10:24
mysql_en-23841.jpg
Photo from Surendra
$ K 2022-08-12 13:49:14
Anyone know the answ of this que
$ K 2022-08-12 13:49:24
mysql_en-23845.jpg

Swapnil 2022-08-12 13:51:43
Atleast post complete photo witg schema and sample data tables
Venkatgunny 2022-08-12 15:25:22
mysql_en-23848.jpg

Venkatgunny 2022-08-12 15:26:08
How can I find monthly growth and weekly growth
Venkatgunny 2022-08-12 15:26:43
I need to find for top 10 tables
Venkatgunny 2022-08-12 15:27:03
There is no date column
Venkatgunny 2022-08-12 15:27:40
How can I find monthly growth
Swapnil 2022-08-12 16:31:47
1.Create a table like below
Table name
date
Month No
week no
size

2. Then keep adding size of each table to this table on daily basis

3.Then create a query that will find size of table now – size of table (recently added date row) in table created in step 1.
This will give you daily growth

4. For monty growth, find size of each table now – last record of previous month

Semi 2022-08-12 18:24:25
Can anyone help me in MySQL
Max Weber 2022-08-12 18:48:32
What is the query to import data into MySQL
sanyam Jatt 2022-08-12 19:21:22
https://www.youtube.com/channel/UC153UaX6VGP5FEf_QdbKndA
Subscribe mt youtube channel for more
Web development
Web design
App design
Ui and ux design
Tutorials
P M 2022-08-13 10:35:15
Using Mac: secure -file-priv error
P M 2022-08-13 10:35:31
Tried to fixed in all ways
P M 2022-08-13 10:36:13
help will be appreciated
P M 2022-08-13 10:36:16
Thank you.
P M 2022-08-13 10:37:55
I’m just frustrated
P M 2022-08-13 10:38:45
Table Data Import Wizard is working fine
P M 2022-08-13 10:39:11
But i want to use LOAD DATA INFILFE
Sandip Londhe 2022-08-13 10:41:31
Put the data source into path of secure-file-priv before loading
P M 2022-08-13 10:46:03
I did
P M 2022-08-13 10:52:18
mysql_en-23886.jpg

P M 2022-08-13 10:52:41
LOAD DATA INFILE ‘/Users/datatech/Desktop/Test/SQL/AttributeDataSet.csv’
into table dress
FIELDS TERMINATED by ‘,’
ENCLOSED by ‘”‘
lines terminated by ‘n’
IGNORE 1 ROWS;
P M 2022-08-13 10:53:25
this is my path
P M 2022-08-13 10:54:08
13:23:48 LOAD DATA INFILE ‘/Users/datatech/Desktop/Test/SQL/AttributeDataSet.csv’ into table dress FIELDS TERMINATED by ‘,’ ENCLOSED by ‘”‘ lines terminated by ‘n’ IGNORE 1 ROWS Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it cannot execute this statement 0.00048 sec
P M 2022-08-13 10:55:01
Any Mac user help please
P M 2022-08-13 11:14:08
LOAD DATA INFILE ‘/Users/datatech/Desktop/Test/SQL/AttributeDataSet.csv’
into table dress
FIELDS TERMINATED by ‘,’
ENCLOSED by ‘”‘
lines terminated by ‘n’
IGNORE 1 ROWS;
P M 2022-08-13 11:14:26
What help you need
Night_Vission 2022-08-13 14:28:35
mysql_en-23895.jpg
Having this error can anyone help
Grv 2022-08-13 16:32:02
Use host address,port number is also not required
|