Any solution to this?
What does this error means how to rectify?
Q kya hogaya bhai ?
MySql ke practice Question provide kr skte ho ?
Anyone have practice Question related to MySQL?
Do we have any DB quarterly patching in MYSQL like we have in Oracle database?
Suppose i want to update 1000 ids i will follow below process
Create temp_table as
select * from table
where ids in (1000 ids);
then do the real update
If possible can use subquery
Suppose you wana update 1st 1000 ids
Update tablename set column = somevalue
where id in (select id from tablename where id between 1 and 1000)
https://t.me/joinchat/aW_4cgawzuZlY2M0
https://t.me/joinchat/aW_4cgawzuZlY2M0
Suppose you wana update 1st 1000 ids
Update tablename set column = somevalue
where id in (select id from tablename where id between 1 and 1000)
These 1000 values will entre by hand each one in querry

This was the table I created to calculate median of lat_n
If I am removing round then it shows the answer else it shows this error message
Any solution to this?

What does this error means how to rectify?
This query is similar to above but from an existing database

This was the table I created to calculate median of lat_n
If I am removing round then it shows the answer else it shows this error message
Any solution to this?
try casting the double precision to int like below
round(cast(avg(lat_n) as int), 4)

Hi guys….
Plz help me..
If I update wrong data….how can I get previous data…..with SQL query
Analyze binary logs unless they expired. They have old and new state. So find your transaction and restore the data row by row
END LOOP; — END OF v_record_inner
— If count is only one value then go for below logic
— For eg Plan D, which has only one usagerateslabs of 999999
ELSE
FOR v_record_inner IN (SELECT * FROM temp)
LOOP
v_slabrate_summation := (v_record_inner.usage – v_slabrate_summation);
v_slabrate_multiply_usage:= v_slabrate_summation*v_record_inner.slabs;
v_final := v_final+v_slabrate_multiply_usage;
v_plan_id := v_record_inner.plan_id;
END LOOP; — end of v_record_inner
END IF; — end of (v_cnt > 1)
— Setting the value to 0
— for next batch of processing
v_slabrate_summation:= 0;
— Updating Billvalue in base Table
— as per plan id
UPDATE test SET billvalue = v_final
WHERE plan_id = v_plan_id;
— Setting the value to 0
— for next batch of proce
v_final:=0;
v_flag:= ‘N’;
— Dropping temp table
— for next batch of processing
DROP TABLE temp;
END LOOP; — end of v_record_outer
END;
$$ language plpgsql;
select * from test;
insert into test values (1, ‘PlanA’, ‘10000,0.25|10000,0.20|10000,0.15|99999,0.10’,33000,null);
insert into test values (2, ‘PlanB’, ‘5000,0.30|10000,0.25|15000,0.20|25000,0.15|99999,0.10’,33000,null);
insert into test values (3, ‘PlanD’, ‘999999,0.25’,33000,null);
DO
$$
DECLARE
v_current_slabrate int := 0;
v_slabrate_summation int := 0;
v_slabrate_multiply_usage int := 0;
v_final int := 0;
v_record_outer record;
v_record_inner record;
v_plan_id int;
v_cnt int;
v_flag varchar := ‘N’;
BEGIN
— Take one record at a time from base table
FOR v_record_outer in (select * from test)
LOOP
— Split single row into multiple rows after | symbol
— and store in temp table for further processing.
— For eg PlanA will be split up into 4 rows
— PlanB into 5 rows and Plan C into 1 row
— depending upon usagerateslabs
CREATE TABLE temp AS
SELECT v_record_outer.plan_id,
v_record_outer.planname,
split_part(usagerateslabs,’,’,1)::int as usage_rate,
split_part(usagerateslabs,’,’,2)::float as slabs,
v_record_outer.usage,
dense_rank () over (order by v_record_outer.plan_id) as rn
FROM unnest(string_to_array(v_record_outer.usagerateslabs, ‘|’)) usagerateslabs;
— Check how many rows a single row has split into
— depending upon | symbol as per above step
SELECT distinct count(rn)
INTO v_cnt
FROM temp;
— If more than one then go for below logic
IF (v_cnt > 1)
THEN
— Now depending upon single row split into N rows,
— process one row at a time
FOR v_record_inner IN (SELECT * FROM temp)
loop
— Process individual usagerateslabs one by one
v_current_slabrate := v_record_inner.usage_rate;
— For eg, Plan A, consider 1st usagerateslabs i.e 10000 < 33000
— then simple multiply 10000*0.25.
— Then take 2nd usagerateslabs again 10000, now we are doing summation
— with previous 1st usagerateslabs (10000+10000 = 20000) and then checking
— 20000 < 33000, if yes then again multiply 10000*0.20000
— and so on
IF ((v_current_slabrate+v_slabrate_summation < v_record_inner.usage) AND v_flag = ‘N’)
THEN
v_slabrate_summation := (v_slabrate_summation+v_current_slabrate);
v_slabrate_multiply_usage := v_record_inner.usage_rate*v_record_inner.slabs;
— For eg, Plan A,consider 4th usagerateslabs i.e 99999.
— Already we are doing summation in above step, where first 3 will
— be summed up as (10000+10000+1000 = 30000). Now if we sum up 99999 i.e
— (10000+10000+1000+99999 = 129999) which is > 33000, hence we will here
— subtract usage (33000) with summation of 1st 3 usagerateslabs (10000+10000+1000)
— which will give us 33000-30000 = 3000.
— Here we will set flag as Y so as if we reach usage of 33000 then going and checking
— next usagerateslabs does not make sense (In Plan B , 99999.0/10 does not make sense)
ELSIF ((v_current_slabrate+v_slabrate_summation > v_record_inner.usage) AND v_flag = ‘N’)
THEN
v_slabrate_summation := (v_record_inner.usage – v_slabrate_summation);
v_slabrate_multiply_usage:= v_slabrate_summation*v_record_inner.slabs;
v_flag := ‘Y’;
END IF;
— Calculating Billvalue by summing up the required usagerateslabs
— For eg. Plan A –> 10000*0.25 + 10000*0.20 + 10000*0.15 + 3000*0.10
v_final := v_final+v_slabrate_multiply_usage;
— Once Billvalue is calculated, setting value to 0 again
— for next batch of processing
v_slabrate_multiply_usage:= 0;
๐๐ฒ๐ถโ๏ธ๐๐๐ฒ๐ถโ๏ธ๐
table name โhistory_sepโ in this table column ‘File’ need to drop this column please any one give me query

Hi please help
table name โhistory_sepโ in this table column ‘File’ need to drop this column please any one give me query
Alter table history_sep drop column file;

Alter table history_sep drop column file;
Thanks!

Alter table history_sep drop column file;
Are bhai bhai BHAi thodi saans toh lelo

Are bhai bhai BHAi thodi saans toh lelo
Q kya hogaya bhai ?๐ฌ

Q kya hogaya bhai ?๐ฌ
Itna bda Code ๐

Itna bda Code ๐
hahah code is not about length, its just about the logic bro๐คฃ

try casting the double precision to int like below
round(cast(avg(lat_n) as int), 4)
Thanks man it worked

Can anyone hands on un sql server…??
Ask your doubts in SQL SERVER group

MySql ke practice Question provide kr skte ho ??????
Use English, please

Ohh sorry
Khan saab

Anyone have practice Question related to MySQL??
Google it

Yes, MySQL do get quarterly release from Oracle
Thank you!