Backup Database from A Docker Container
SitePoint Community » Databases
by piratemac541
2d ago
Hello, I’m trying to backup a database I’ve created locally on a docker container following the description in MySql NOvice To Ninja book. On my previous Mac I used the following command whilst the container is running to create a backup: docker-compose exec -T mysql mysqldump -uroot -p$PASSWORD --databases $DATABASE --skip-comments > /Path/to/folder/dump.sql However on my new mac I get the following in the sql file and nothing else: OCI runtime exec failed: exec failed: unable to start container process: exec: “mysqldump”: executable file not found in $PATH: unknown Any ideas or workaround ..read more
Visit website
Which is best way of creating a database for each or one table in a database in MySQL?
SitePoint Community » Databases
by thirupathi
1w ago
We are working on IoT device, each device will stores about 20 mb of data each month and we have 20K and more IoT devices in the filed. we need storage for 7 years. So which is best way of creating database for each device or one database with one table or one database with multiple tables ? Try to understand that all 20,000+ IoT devices have the same data and IoT with unique ID. Each IoT device will store 70 columns of data and insert it every 1 minute. So, it will store 1,440 rows a day, 42,300 rows per month, 518,400 rows per year, and 3,628,800 rows per 7 years. This calculation is for onl ..read more
Visit website
Using ROLLUP MySQL
SitePoint Community » Databases
by UncleVince
1w ago
Hi, I use ROLLUP MySQL for generates additional rows in the result set that represent subtotals and grand totals for the grouped data. The grand total is calculated for all the data in the result set My problem is in the last row of result set because on the last row of the second column is repetead the previous row, instead null value. On the last row of first column I have instead correctly the Total value. Can you help, please? My code below > mysql> SELECT > COALESCE(AREA_Cod, 'Total') AREA_Cod, > Area_name, > SUM( CASE WHEN Event_date = '2024-04-01' THEN ROUND( r ..read more
Visit website
SQL Server transposing rows to columns
SitePoint Community » Databases
by UncleVince
1M ago
Hi all, I need to transpose rows to columns to display data in different dimensions or meet table format requirements using SQL server. Starting from this query and this return SELECT _p, _t, _x, COUNT (*) _q FROM [dbo].[subset_data] WHERE CONVERT ( VARCHAR ( 10 ), data, 120 ) = CONVERT ( VARCHAR ( 10 ), GETDATE( ), 120 ) GROUP BY _p, _t, _x; +--------+--------------+----------+--------+ | _p | _t | _x | _q | +--------+--------------+----------+--------+ | 001 | 06:00-12:00 | 15 | 1 | | 001 | 12 ..read more
Visit website
Asking me to specify autoincrement value when inserting
SitePoint Community » Databases
by Stribor45
1M ago
Why is mysql asking me specify value for column that is on autoincrement? $sql = "CREATE TABLE IF NOT EXISTS My_Table ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR (10) NOT NULL, PRIMARY KEY (id) )"; insert into My_Table values ('John' ); // doesnt work insert into My_Table values (1, 'John' ); //does work #1136 - Column count doesn’t match value count at row 1 7 posts - 3 participants Read full topic ..read more
Visit website
Frustration with online datasets
SitePoint Community » Databases
by bbs
3M ago
I find it frustrating when a website locks up a dataset behind a query-based searchbox. It makes sense only when the data are proprietary, and then only if the developer applies sufficient security precautions to prevent mass downloads. To be clear, when you provide a dataset a .txt or .pdf file is excellent for human eyes to read, but a .pdf requires OCR analysis to extract the data that the developer already had in a perfectly good database. I find that a pipe-delimited .csv file is the simplest format to receive data. For my websites, for example, a cemetery burial list of perhaps 5000 pers ..read more
Visit website
SQL Server DateDiff oddity
SitePoint Community » Databases
by DaveMaxwell
3M ago
Found an oddity that I’m hoping @r937 can explain to me but if anyone else has insight, I’d appreciate understanding why this occurred. I have a legacy system that stores date values in strings instead of date fields(much to my chagrin). I have a field where the value is ALWAYS a valid date, and the query I ran into this oddity looks for dates between 60 and 180 days old. For some reason, this month, the query got an error. I was able to work around it because we have that particular date stored on another table as an actual, you know, date. I know, I know…two tables, same data…why? Simple an ..read more
Visit website
Extract first friday of march month using current month with mysql 8 version
SitePoint Community » Databases
by cms9651
3M ago
How can I get the date of first friday of march month using current month with mysql 8 version? Thanks in advance. My code below… the return is not the first Friday of March, but the last Tuesday of March SELECT CASE WHEN MONTH(CURDATE()) = 1 THEN DATE_ADD(DATE_FORMAT(LAST_DAY(NOW()) - ((7 + WEEKDAY(LAST_DAY(NOW())) - 4) % 7), '%Y-%m-%d'), INTERVAL 2 MONTH) ELSE NULL END last_friday_march_month; +-------------------------+ | last_friday_march_month | +-------------------------+ | 2024-03-26 | +-------------------------+ 1 row in set (0.06 sec) 5 posts - 2 participants Read full ..read more
Visit website
Extract data from one special object out of JSON array in mySQL
SitePoint Community » Databases
by Thallius
4M ago
Hi I have a mySQL database with a table named “orders”. In this table I have a column named ids which is JSON. The JSON looks like [ { "type" : "master", "id" : "100" }, { "type" : "slave", "id" : "101" }, { "type" : "slave", "id" : "102" }, .... ] I need a select, which gives me the id of the object which is of type master. How can I do this? 1 post - 1 participant Read full topic ..read more
Visit website
How to reverse a string?
SitePoint Community » Databases
by bendqh1
4M ago
Take a string like +54321, how to reverse it to +12345? In Bash: echo +54321 | rev 12345+ rev is not self explanatory. How would you suggest to do that in a self explanatory way but with the least amount of code? I was thinking about C, Python, Perl, Java and C#, but I never worked with any of these languages. Personally I would prefer an interpreted language like Bash or JavaScript over a compiled language but please feel free to share your most preferred way with either. I didn’t find a way which I would consider “both clear and self explanatory” to this with the current release of JavaS ..read more
Visit website

Follow SitePoint Community » Databases on FeedSpot

Continue with Google
Continue with Apple
OR