Questions tagged [mysql]

MySQL is an open-source, relational database management system. If your PHP code uses MySQLi, use the MySQLi tag instead.

95 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
239 views

Automatically generate TypeScript classes from database tables

Made a project to generate TypeScript classes from database tables, and I'm looking for input if the code is reasonable. pg and ...
4
votes
0answers
50 views

ThorsSQL Lib: Part 3: Layer 3

Have a working version of MySQL implementation of ThorsSQL library done. If you want to check it out you can find the whole thing on github ThorsSQL. This is a follow on to previous code Reviews: ...
3
votes
0answers
54 views

MySQL JSON diff procedure

I'm building a procedure which compares two JSON objects and return two JSON objects with differences between each (compared keys and values). But I have relatively superficial SQL knowledge, so I ...
3
votes
0answers
492 views

Generic Unit of Work implementation

I am implementing the unit of work pattern to be used in the logic layer of my application. The goal is to abstract away the tasks of managing transactions / connections. My implementation relies ...
3
votes
0answers
1k views

Full text search for multiple words using Laravel and MySQL

I'm using Laravel 5.6 and MySQL. I need to search multiple columns for a single word or multiple words (e.g., "camhandle", "cam handle"). The way I was originally doing it was just using ...
3
votes
0answers
261 views

Query your MySQL server for table size by row count and physical size by database

After writing a similar SQL procedure to check my table sizes several times, I wrote this stored procedure to check my MySQL database's table size. It will show you the table sizes and row count ...
3
votes
0answers
81 views

PHP Laravel function to search for ads in MySQL

I am new to the Laravel framework. I have recently written a function which gets called through a route. The function is created for two purposes: Get ads from a particular city based on provided ...
3
votes
0answers
166 views

Database check in a loop

I have a python script that loads a database table and checks an API for the entries found. I do it like this: ...
3
votes
0answers
56 views

A function that debits a virtual wallet and calls an API to disburse to a real account

I am trying to determine if there is a better way to handle reversals for this function. This is how it works: A user inputs in amount, bank, and account number this would be used to debit his ...
3
votes
0answers
27 views

ThorsSQL Lib: Part 3: Layer 5 Request/Response

Have a working version of MySQL implementation of ThorsSQL library done. If you want to check it out you can find the whole thing on github ThorsSQL. This is a follow on to previous code Reviews: ...
3
votes
0answers
37 views

ThorsSQL Lib: Part 3: Layer 2

Have a working version of MySQL implementation of ThorsSQL library done. If you want to check it out you can find the whole thing on github ThorsSQL. This is a follow on to previous code Reviews: ...
3
votes
0answers
551 views

Processing database data into a multidimensional array

The purpose of this code is to get data from the database and output it into a multidimensional array in JSON for my web app. But my gut instinct is telling me this code is way too messy and just ...
3
votes
0answers
100 views

Getting a list of manufacturers from a database

I'm new to Zend Framework. Can you help me optimize this function, which gets a list of Manufactures with some conditions from a database? ...
3
votes
0answers
101 views

Keeping track of voting

There is HTML that triggers the code below I want to disallow executing the script more than once per 24 hours. I wanted this script to store the last visit time in a table against the user ID in a ...
2
votes
0answers
18 views

Querying Aurora via Node.js

Function queries data from an Aurora database. Aurora database is the MySQL engine therefore, I'm querying it with a MySQL NPM module. If there is something better, I'm all ears. The calling function ...
2
votes
0answers
28 views

Insert data from one table to another (million+ rows)

I have a procedure that collects data from one table and inserts it into another table with the same columns, but after correlating with a few other tables. Since the existing table (from which data ...
2
votes
1answer
63 views

Optimize Multiple Insert SQLite Coming From MySQL

I'm currently developing an app that requires sending and receiving of data from android studio going to MySQL and then data coming from MySQL will be saved from the SQLite. I need advice on how to ...
2
votes
0answers
82 views

Python graphene-graphql, are global constants for SQL queries a good idea?

For python 3.6.5 using graphene-graphql and mysql-connector Context: I wrote an API using graphene, a python graphQL implementation, this is actually my first time using the graphQL specification so ...
2
votes
0answers
2k views

MySQL database schema for e-commerce website

I'm making an e-commerce site, using MySQL for storing data. ...
2
votes
0answers
69 views

One class for MySQL and MSSQL Queries

EDIT BELOW I am trying to create resusable classes for MSSQL and MySQL queries (later also Update and Delete queries). I tried it doing the OOP-way. Here is my result: Einstellungen.vb: ...
2
votes
0answers
58 views

Exporting tables from 30 databases

What my code do: Connecting to 30 DB (consistently) Copying DB file to temp.dat Reading temp.dat Writing read data to file So, it connects 30 times with different databases. This take 6-7 second (...
2
votes
0answers
34 views

Many to many (n to m) relationship without insert duplication php

I managed to make a many to many relationship work correctly using mysql, doctrine 2 and symfony 3.4. When a new element A that contains 0 to m element Bs is inserted, the B elements that already ...
2
votes
0answers
53 views

Calculating effective shop inventories (SQL)

This is an SQL version of that question. Shops and groups The problem domain is a collection of shops (identified by an int shop_id number) each of which is ...
2
votes
0answers
703 views

Async/await Mysql wrapper

I used MySQL, but it was inconvenient so I made a wrapper. It works, but I'm unsure if there are any issues. Used node module - mysql2, bluebird sqlWarpper.js ...
2
votes
0answers
40 views

Counting distinct number of items in multiple group by query efficiently

I have the following query that counts the number of vessels in each zone for each week: ...
2
votes
0answers
43 views

Breaking down retention metrics

Does this code calculate the retention rate per acquisition channel correctly? $$ R = \frac{E - N}{S} * 100 $$ Where \$E\$ is the number of customer at the end of a period, \$N\$ is the number of ...
2
votes
0answers
42 views

Optimising code for performance Concrete5/PHP/MySQL

I am trying to be as efficient as a I can using a CSV to import users to a CMS called "Concrete5 - Version 8.2.1". I have a list of 700+ users and i've created an upload screen to take in a CSV and ...
2
votes
0answers
58 views

I wrote some import functions from APIs for a large scale application

I run a large scaled app much larger than I can handle or develop for, website grew out of control and currently has over 22000 users. We support importing from different APIs, each import is split ...
2
votes
0answers
51 views

Joins on same table with MAX()/MIN() and corresponding fileds

I made a query for showing max and min value and dates that are corresponding to those MAXs and MINs. The idea was to show max/min value and the date when the those values occurred in one row for ...
2
votes
0answers
273 views

MySQL Schema for Tag System Works, But Can It Be Better?

I'm working on system that tags images. I'm going to use the xxHash (lz4) for hashing images. With hashes of size 64 bits, it looks like I won't have a 50% chance of a collision until ~4 billion ...
2
votes
0answers
26 views

Filter table with drop down values given multiple constraints

I have a table that stores drop down list values. The table looks like this: ...
2
votes
0answers
406 views

C# MySQL Database Library

Below is a database manager and a class called database connection. The database Manager controls the database connection string and generates a new database connection when you need one. I'm looking ...
2
votes
0answers
158 views

Concurrent AWS S3 copying of images listed in MySQL

I created the following one off script and it did the task quite well (1000s of requests / second with low CPU usage - outperformed the previous python script in every aspect). But I am wondering if ...
2
votes
0answers
87 views

ThorsSQL Lib: Part 3: Layer 5 HandShake

Have a working version of MySQL implementation of ThorsSQL library done. If you want to check it out you can find the whole thing on github ThorsSQL. This is a follow on to previous code Reviews: ...
2
votes
0answers
148 views

PHP tagging script

I have created this PHP script in Laravel. I have database table with items and in my app I can create tags with different regexes. If regex matches text in description or epoch. I will insert ...
2
votes
0answers
28 views

Planning the tours of home care employees as a stored procedure

We had an assignment to create a database for a fictional nursing service. To get accustomed to stored procedures we should implement one of our own choice. I decided to try my hands at writing a ...
2
votes
0answers
41 views

MySQL Workbench RoR Migration Exporter

I created plugin for MySQL Workbench that allows you to export an ER Diagram to RoR migration files. I would like to know if any other developers appreciate it. export-rails-4-migrations_grt.py <...
2
votes
0answers
82 views

Query for searching for the best transportation

I made a website where is possible to search for the best transportation from a place to another. For instance, if I need to go from Berlin to Bremen, the website will search in its internal database ...
2
votes
0answers
26 views

Search Indexer Transaction Safety

I am writing a search indexer for a site I built. It counts the number of times a word is used in a given story allowing one use of the word per chapter. I have also attempt to weight words in the ...
2
votes
0answers
59 views

Fantasy league tracker for Game of Thrones

So I've just started learning about MySQL and PHP to create a fantasy league tracker for Game of Thrones for my office. I got it to technically work fine, but I think it's way clunkier than it has to ...
2
votes
0answers
55 views

Retrieving the most recent posts from the users someone is following

I have two different implementations for retrieving posts from the users someone is following and I want to know which one you would recommend using. First I'll show you the tables, and then the two ...
2
votes
0answers
47 views

Selecting the most recent record for each product

I have the following structure of a table: ...
2
votes
0answers
413 views

Chat application built with Node

In an effort to teach myself Node.JS and truly delve into its communication capabilities, I elected to recreate a previous chatting project. It took a bit of forethought to acclimate code to the ...
1
vote
0answers
36 views

Optimizing Node MySQL Query for CPU Utilization

I am working on a NodeJS port listener code that listens to a particular TCP port on the server. The obtaining the data from the port, the data is split using a delimited (for instance comma ...
1
vote
1answer
53 views

Shoutbox system

I wrote a little Shoutbox System which is working fine, but I want to know if there is something I can improve about this code. Here is my Shoutbox Overlay: ...
1
vote
1answer
45 views

Dynamically inserting html from external file and updating the database

I need some suggestions on how to approach this. I want to allow users to create sections of website. The code so far is working but since I am new to back-end I feel like there is better, more ...
1
vote
0answers
25 views

Stored procs fine tuning for processing bulk data - 5 million records

I have this procedure which is used for bulk upload data from a temporary table (temp_rules_master) into two other related tables. It has 5 million records. The ...
1
vote
0answers
29 views

Retrieving information about a vendor using MySQL

I am loading some information about the selected vendor using mysql query. I made a method with a List as return type, then created another method to assign values coming from a list. I am wondering ...
1
vote
0answers
46 views

Writing SQL queries to retrieve data from given tables

Good day, I am a college student and lately we had an assignment where we were tasked to write SQL commands on various questions depending on the information that is needed to be displayed from 3 ...
1
vote
0answers
81 views

Consumer Producer problem solution using JDBI, MySQL, HikariCP

The app suppose to solve a subset of Producer–consumer problem. One producer, one consumer thread and buffer. The idea of the app to handle correctly database downtimes. The solution is to keep ...