relational-database

draw an ER diagram that fulfills the information about the car dealer company which is described below.

This car dealer company has many branch offices. In each of these branch offices, some sales people are working whose job is selling cars to customers. You need to define your branch offices in your diagram. And also, you need to define sales people who are working in these branch offices. - This company sells cars, so you must store car...

Should I add total count in a the main relational table

I'm doing something different but this is an easier to understand example. Think of the votes here. I add these votes to a separate table and log information about them like by who, when and so on. Would you also add a field to the main table that simply counts the number of votes or is this bad practice. ...

Do ORM frameworks take care of / suggest indices on the DB tables?

I haven't gotten into ORM frameworks much yet, and could use some input from experienced practitioners. Some of these questions may be naive. Please bear with me. In mapping objects to relations, do these frameworks also suggest indices that may be necessary for the queries to execute efficiently? The queries generated by ORMs, are the...

which data structure is used in most popular databases?

i want to know which data structure(AVL, B-Tree, etc...) is used in most popular relational databases. and also in what way the data structure is superior than other in-class data structures? if possible a small comparison could help me a lot! thanks in advance! ...

Users table - one table or two ?

i wanna have a Users details stored in the database.. with columns like firstname, last name, username, password, email, cellphone number, activation codes, gender, birthday, occupation, and a few other more. is it good to store all of these on the same table or should i split it between two users and profile ? ...

Relational database foreign key constraints usage in practice

So you have a relational database and you define some foreign keys for reference integrity. But now, what's the better way to leverage them? Assume we are going to delete a row in a table with foreign keys to other tables. Use them as a garbage collector - Set all constraints to cascade. So in your application, you first check if the t...

Pattern match within the IN operator (MySQL)

I would like to match patterns inside an IN expression like this: ... WHERE ... IN ('%alma%','%sajt%') Is it possible somehow and if not, how could I achieve this some other way? ...

Cakephp Relationships

I have a few models which are not in the default cakephp format user(id, name....) 1 Harsha ... 2 John .... dishes(id, name, price ...) 1 "Cheese Pizza" 6 2 "Zinger Burger" 3 restaurants (id, name, .....) 1 "KFC" ... 2 "Pizza Hut" ... module(id, name) values (User, Dishes, Restaurants) 1 "Users" 2 "Dishes" 3 "Restaurant" i...

transfer function in cakephp see my explanation please

please help me with my simple cakephp application. i have a products_warehouses table: -- -- Table structure for table `products_warehouses` -- CREATE TABLE IF NOT EXISTS `products_warehouses` ( `id` int(5) NOT NULL auto_increment, `product_id` int(5) NOT NULL, `buyprice` decimal(8,2) NOT NULL, `sellprice` decimal(8,2) NOT NU...

ERD diagram and SQL relationships linking user, project and dataset tables.

Hi guys, I have several tables in my ERD which which I would like to combine in a relational manner. I have several use cases, but I completely lost track of what kind of relations to use between the tables. Every user can work on multiple projects. Every user has one specific role per project (Manager, Contributor, User) Every proje...

Relational database design - Two Relations 1:1 or one 1:2 ?

Hello everyone! This question is about how to design a SQL relationship. I am pretty newbie in this matter and I'd like to know the answers of (way) more experts guys... I am currently migrating a ZopeDB (Object oriented) database to MySQL (relational) using MeGrok and SqlAlchemy (although I don't think that's really too relevant, sinc...

Is it possible to create detailed error messages from complex database queries?

Let me illustrate this question with a simplified example. Assume I am building a project using python with a PostgreSQL relational database. In my database I have two tables "parent" and "child" which are N to M related through the table "parent_child". I want to be able to retrieve some data about a specific child owned by a specific p...

Has anyone seen an implementation of adaptive fetching for ORMS?

The idea being that sometimes you don't know the characteristics of your data all that well so deciding which objects to fetch in their entirety is just an educated guess, and could vary depending on network conditions, etc. A good first approach at deciding what object links to follow and load from the database in a particular scenar...

Is there a program to draw entity-relationship graphs?

I have a homework that I wanna present neatly. ...