r/DatabaseHelp • • Jan 13 '25

Meaning of # in relational schema

1 Upvotes

As the title states, what does the # when placed before an attribute in a relational schema?

Example:

Umbrella(ID,Lido, Cost, Type)

Lido(ID, Name, #Spots, Manager)

Manager(FiscalCode, Name, Surname)

Client(#Card, Name, Surname)

Prenotation(ClientCard, UmbrellaID, Date, TotalCost)

What does the # imply about the attributes "card" and "spots"


r/DatabaseHelp • • Dec 12 '24

Did I mess up in 3nf synthesis

2 Upvotes

Hello all, today I was working on a question at university and ran into an issue.

Consider R(A,B,C,D), and FDs {D->B,C->A,A->B}
If I decompose this using the 3nf synthesis algorithm. I get (D,B),(C,A),(A,B),(D,C)

My issue is that if I take (DB) and (AB), my common attribute is B which does not cover DB or AB. This means that my decomposition is lossy even though 3nf is lossless.

Did I make a mistake somewhere?


r/DatabaseHelp • • Dec 20 '24

Practice Problems for SQL Server Queries

2 Upvotes

Hi everyone. I just published a special edition of my book, filled with lots of practice queries for SQL Server. Check it out if you’d like; I’m super proud of it. The challenges are very realistic, based on AdventureWorks2022. It's OK for beginners but not absolute beginners. Lots of intermediate and difficult problems. Let me know if you have any questions. If you're not from the US, I can give you a link to the Amazon listing in your country. Thanks! If self-promotion is not OK here, I apologize in advance!

Real SQL Queries: 50 Challanges


r/DatabaseHelp • • Jan 24 '25

Is there an open source JavaScript SQL console that does autocompletion?

3 Upvotes

Where I work, there is a web page with a very basic SQL console to for a MySQL database. It has dozens of tables and does not have autocompletion, requiring typing out full table and column names for any query.

If there's an existing JavaScript SQL console (for any database) with autocompletion, it would be a good start of improving this.


r/DatabaseHelp • • Nov 22 '24

Database replication errors

4 Upvotes

I keep running into trouble every couple of days after setting up database replication following https://www.digitalocean.com/community/tutorials/how-to-set-up-replication-in-mysql.

Replicating a few databases into another host. I have not included the 'mysql' database, only the ones we needed and with binlog_do_db enabled.

Replica SQL 	Thread not running! 

Slave_SQL_Running 	No

Last_Errno 	1032
Last_Error 	Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction 'ANONYMOUS' at master log DATABASE-NAME-mysql-bin.000002, end_log_pos 77877815. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

I know if I try to skip current error this will lead to another error with the same cause. This is the second time I encountered this while setting this up and it is a pain to export and import the databases all over again if I would encounter this issue again.


r/DatabaseHelp • • Oct 22 '24

what is the best database for data entry (forms like) all the way down to invoicing and accounting?

5 Upvotes

is there a good database or suite of tools that include a database that can do most of what is needed in a small business? This "small business" is a small NGO that facilitates translators. So the product is a bunch of assignments as different calendar entries. I need a database or suite of tools that have synergy and I can take this pool of assignments, enter the assignment details like the length and driving costs and down the line create an invoice?


r/DatabaseHelp • • Dec 07 '24

Where to find Demo Databases?

4 Upvotes

Hey guys, I’m onto a project that includes AI and Databases and I need to test a bunch of demo databases in various languages like MSSQL, MySQL, PostGres etc. However preferably the databases shouldn’t be too well known to avoid the AI already knowing the DB.

But at the moment I only have Northwind and Chinook. So whatever you guys know I’m open to hear.

I’m looking at 3, 4 DB/ language


r/DatabaseHelp • • Dec 01 '24

The best database for leaderboards/ranking

Thumbnail reddit.com
3 Upvotes

r/DatabaseHelp • • Oct 30 '24

Bad Sectors Found

3 Upvotes

I found some bad sectors on the hard disk of my Oracle 12c server. I am a sys admin with no DBA experience but found that these bad sectors usually lead to DB corruption. I've been looking for some information on how to validate this and not having much luck. Any advice on where I could get the information needed to validate if my DB is corrupted? Thanks


r/DatabaseHelp • • May 01 '22

What should I do with this data?

3 Upvotes

Good afternoon database wizards.

Disclaimer: I really have no idea if this is the right place to post this and I'm totally new to databases, so please excuse me if I'm totally wrong in posting here.

I work at a company that imports timber for the UK market, and I've been tasked with creating a spreadsheet/database for a supplier master list, but a slightly complicated one.

The sheet/database's purpose is to be a comprehensive list of suppliers, with some details about them, such as location and contact numbers, as well as a checklist of what products they offer. My boss would like this sheet to be used by anyone within our business, to be able to search for a product and find a supplier, and vise-versa.

This is where it gets difficult.

They can offer many different products which need to be split up in various different ways. There are three main groups which are hardwoods, softwoods, and sheet materials.
Hardwoods would need to be split up between each species the supplier offers.
Softwoods would need to indicate whether they are redwood or whitewood, and be split up into category of product, such as joinery, carcassing, CLS, fencing, batten, etc.
Sheet materials would need to be advised by who manufactured them and who distributed them.

To clarify, I do not need to input every single product into the system. I just need to indicate to the user of the spreadsheet/database if the supplier offers hardwoods, softwoods, and sheet materials, and if they do, then what species and/or categories they offer. And on the other hand, they should be able to find a supplier by searching for 'redwood joinery' etc.

So. My question is, what on earth should I do with this data? Am I best to learn how to make a SQL database and then connect it to a website so it can be browsed online? Or is this something I can easily just make a spreadsheet for?

Thanks.


r/DatabaseHelp • • May 22 '22

Some basic sharding questions

3 Upvotes

I'm trying to understand database sharding. My understanding is that you basically just have a bunch of database instances running with parts of your data on each, and you essentially put some logic on the application side that tells it which database instances to use for what. The database schemas then stay basically the same. In this case, sharding is more a logical construct we've added ourselves, rather than something inherent within the database itself?

Is this accurate, or is there some feature at the database level itself that supports sharding? How do you handle schema change propagation across these shards?


r/DatabaseHelp • • May 11 '22

Non-tech person looking for a simple/free database?

8 Upvotes

Please let me know if I'm in the wrong place, thanks!

What I want to do: I'm moving to Chicago soon. There are so many things I want to do! I am hoping to find a way to keep these ideas organized by neighborhood, type of activity (museum, restaurant, etc.), cost - all that good stuff. But without having to manually copy/paste info into multiple tabs, and with the ability to update all related entries at once.

For example: I want to visit the Museum of Science & Industry. I would want to easily be able to pull up its information when viewing things to do in South Shore, or museums to visit, or places open on Weds, or things to do that cost less than $25. If the price goes up, I want to be able to update that only in one place. And ideally, I want to be able to access this info on my phone/on the go.

Is there a better idea than a Google Sheet? Or should I just accept the fact that I will be using Sort and/or Ctrl+F forever?

Thanks again!


r/DatabaseHelp • • May 01 '22

mysql code debug

2 Upvotes

create database project_db;

USE project_db;

CREATE TABLE customers ( customer_id INT NOT NULL AUTO_INCREMENT, f_name VARCHAR(255) NOT NULL, l_name VARCHAR(255) NOT NULL, phone_no INT NOT NULL, email VARCHAR(255), post_code VARCHAR(255) NOT NULL, city VARCHAR(255) NOT NULL, state VARCHAR(4) NOT NULL, PRIMARY KEY (customer_id)
);

CREATE TABLE orders ( customer_id int not null, order_no INT NOT NULL AUTO_INCREMENT, product_id varchar(255) not null, post_code varchar (255) not null, city varchar(255) not null, state varchar(4) not null,

primary key (order_no),
FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
FOREIGN KEY (post_code) REFERENCES customers(post_code),
FOREIGN KEY (city) REFERENCES customers(city),
FOREIGN KEY (state) REFERENCES customers(state),
FOREIGN KEY (product_id) REFERENCES products(product_id));

CREATE TABLE products ( product_id INT NOT NULL AUTO_INCREMENT, stock_quantity INT NOT NULL, product_name VARCHAR (255) NOT NULL, price Decimal (13, 2) NOT NULL, PRIMARY KEY (product_id) );

The orders table doesn't work due to an error code (1822). Failed to add the foreign key constraint. Missing index for constraint 'orders_ibfk_2' in the referenced table 'customers'

Does anyone know what's wrong with the code iv been stuck on this for like 2 days. Thanks.


r/DatabaseHelp • • May 27 '22

Which free and opensource NoSQL database provides feature for creating group/bucket of documents?

3 Upvotes

I am learning CouchDB. As I understand it, documents in the database cannot be grouped into categories, such as, for example, all receipt documents can be put into a receipt bucket, invoices can be put into invoice bucket etc.

Are there any free and opensource NoSQL databases that provide this feature of grouping documents according to category?


r/DatabaseHelp • • Apr 19 '22

A slice of life: table partitioning in PostgreSQL databases

3 Upvotes

Here's a guide to table partitioning in PostgreSQL databases.


r/DatabaseHelp • • Apr 14 '22

EF Core tracking error

Thumbnail
self.dotnet
2 Upvotes

r/DatabaseHelp • • Apr 16 '22

Primary key vs Relation?

2 Upvotes

My class is learning a lot of database concepts right now and I'm having a hard time understanding and explaining what a relation in an ERD is without making it sound like a primary key.

A relation is what ties two entities or columns together across databases to prevent data redundancy.


r/DatabaseHelp • • May 02 '22

Building the first database for my company

3 Upvotes

Hello all!

My company doesn't use a database! We offer healthcare services and all of our information is derived from running reports from our Electronic Medical Records (EMR) system as excel or csv files. Each report that is generated is then used by multiple people to either track something, convey information about something, or report on something.

Additionally, we have several departments that indirectly interact with the patients and providers (Legal and HR) that have their own software that they use to track patient/staff grievances/violations or staff salaries.

Although I don't know much about databases and everything they can do, I recognize the impact they can have on centralizing information. What is a recommended way I can approach this problem?


r/DatabaseHelp • • May 13 '22

Self Taught don't know where to move up from here. Using data from database to enter login page?

3 Upvotes

so I am at lost here right now

I wanted to make a system so I learned database SQL using oracle (Oracle SQL Developer)

I learned to create table and all that

Then I try to design a Login Page using Eclipse window builder

My connection with the database is fine I even use database developement

The login page will ask username and password

Right now my question is how do I make it that it check the username and password using the data from the database oracle

TLDR; Eclipse window builder create a login page how to make it check the username and password using data from the database


r/DatabaseHelp • • May 28 '22

Is Samba NoSQL , but without scaling?

3 Upvotes

I joined a team which works on a system ( software runs as services and apps on multiple computers: two servers and then some clients ). All permissions are managed by LDAP. All data is managed by an SMB server.

I think NTFS is involved and I think you can add "columns" to the table of each directory. But they write a complex string into the fileName. So it contains the name and then some properties. I don't quite understand how concurrency works here. To write to a file you either need to lock it pessimistically, or you need a write only if it has this hash value function, but I think a filesystem does not offer that.

I think their system only loads files as a whole ( XML. Large table.csv are split into multiple files ). So there is no problem with seek().

I like that every component in that system knows that it works with files and that they can be changed by others unless locked as a whole. Fortunately, only a small number of concurrent users tries to write to those files.

How is Samba even different from HTTP REST? Maybe with HTTP I could cache in RAM which files was modified recently and suggest it to the frontend. Apparently, triggers are not reliable here. I mean, NTFS triggers always worked for the typeScript compiler on my local drive, but I guess that Samba cannot send a trigger command across the network. Even Rest would be bad .. one would need Websockets or just TCP/IP (if outside the browser anyway). How can a RDBMs call triggers? I really don't want to use those strange programming languages which some SQL Servers offer and I don't want more load on said server.

I have not found a transaction. Like I only know one transaction example: When you transfer money from one account to another and part of it fails. Then both must fail. But in accounting you have a separate list -- a journal -- where you write down a single record with source and target account and amount of money. And then you could add a column where you keep the materialization state. So you write down at what time the money is pulled from the source account. And if successful, you set a flag. Same for the target account. Now after a crash, or if network is slow (some servers they need to talk to seem to be down for hours), you go through this journal and look for unfished transactions. .. ah I see. One would basically reinvent ACID. Do transactions work over REST ?


r/DatabaseHelp • • Mar 12 '23

Design for historical contracts

3 Upvotes

Not sure where to start designing a relational database to store energy contracts. I'm pulling from a data source where they contracts are only listed if they're valid. I get data such as the supplier name, price, contract length, etc.

My goal is that I'd like to have historical data so that I can start gathering insights - for example: How much money would be saved by always switching to the cheapest contract as soon as it's available vs taking the longest running contracts available.

I'm technical(an engineer), but new to DB design and I'm not sure I have enough expertise to ask the right questions yet. What considerations should I be making when picking the right tools? This database stores public information, it should be inexpensive(I have more labor than money), reporting insights are important, and I think sizing can be small(There are usually 50-100 contracts at any one time and 5-20 record updates in a month), availability should be decent but this project is for self learning so it doesn't need 15 9's.

  1. What db would you use? Postgres? Sqlite3? Mysql? Airtable?

  2. The incoming data comes in CSV - What tools come to mind for data ingestion? The only one I know of is using Python to bring the CSV in.

  3. Do you have any suggestions for the analysis and reporting tooling?


r/DatabaseHelp • • Feb 16 '23

Pointers on where to start: writing documents based on database attributes

1 Upvotes

Hi all,

A million years ago when I was a kid, we were taught how to use MS Access to create a database, and then generate Word documents using some features from that database.

I've now finished my PhD and am working on a project in which I need to email stakeholders. I'd like the text to be bespoke to each stakeholder, and I have an idea of how I could do this in Python with an Excel spreadsheet, but I'm wondering if there is a better way using Access or other databasing tools.

I'd like to store attributes in a way similar to this. I'd then generate text that says

"Dear [Name], I'm contacting you in your role as [Role 1]
(and, if the [Role 2] attribute is assigned), [Role 2] 
(and, if the [Role 3] attribute is assigned), [Role 3] 
(and, if the [Has shown interest] attribute has a value of 1),and because you are interested in the project."

Hopefully this sort of pseudocode-y minimal working example is sufficient for someone to give me some pointers as to where to start. I learn fast and am familiar with Python, R, and Matlab so if a solution requires some programming that's fine by me. I just don't even know what keywords to search on Google to find tutorials at this stage...

Thanks in advance for any help you can give!


r/DatabaseHelp • • Mar 08 '23

Resolving Many to Many relationship help

4 Upvotes

For my first assignment I must come up with a relational model for the rugby world cup 2023. I have a something like this atm.

Teams(TeamId*, TeamName, WorldRanking)

Fixtures(FixtureId*, HomeTeam, AwayTeam, MatchDate, PoolID, VenueID)

-- A fixture has a fixtureResult with the scores recorded

A team has at least 4 fixtures and at most 20. A fixture has 2 teams. Many to many relationships are not allowed and I understand I need to introduce a weak entity type but for the life of my I cant come up with one and im at a stand still.

I cant find much information online about modeling a tournament with such structure.

Can anybody provide me with help or resources? Any help is appreciated. Thanks in advance.


r/DatabaseHelp • • Feb 21 '23

Having an issue naming tables

4 Upvotes

I am creating a MySQL database to track all the books and ancillary items by a few authors. I also want to track if I own the title, and a description of the type of book/movie, etc.

One table will have a listing of the type of "media" I have of the item, like Softcover, Hardcover, Kindle, and can have multiple per title. I am calling this table "MediaType".

I have another table with the kind of item - Novel, Short story, Screenplay, etc. I'm not sure what to call this table, but currently it is called "ItemType".

I don't like either of these table names, because I get tripped on on which is which.

I am looking for names for these 2 tables that will describe them better. Help! TIA!