rdbms

Why aggregate functions in PostgreSQL do not work with boolean data type

时光怂恿深爱的人放手 提交于 2019-12-10 18:09:41
问题 Why we cannot use boolean values in aggregate functions without casting to some integer type first? In many cases it makes perfect sense to calculate sum, average or correlation from columns of boolean data type. Consider the following example where boolean input has to be always casted to int in order to make it work: select sum(boolinput::int), avg(boolinput::int), max(boolinput::int), min(boolinput::int), stddev(boolinput::int), corr(boolinput::int,boolinputb::int) from (select (random() >

Having trouble setting a computed column as not Null

Deadly 提交于 2019-12-10 13:33:28
问题 I'm having problems setting a computed column as not null . What I want to achieve is C001 , C002... , etc. and at the same time set it as not null . I have read on a forum that this can be achieved by using the default value 0 for NULL values. E.g., ISNULL(Price + Taxes, 0) I have tried to apply to this formula: ('C'+right('000'+CONVERT([varchar](3),[ID],(0)),(3))) But it didn't seem to work. Can anyone tell me what am I missing? ALTER CreditCard accountNo AS ISNULL('C'+right('000'+CONVERT(

Migrating from 'native' OODBMS to ORM (Entity Framework / SQL Server)

痞子三分冷 提交于 2019-12-10 11:14:30
问题 A while ago we started developing a new project which internally has about 25-30 different classes/types/models that are heavily related to each other either via 1:n, n:m or n:1 relationships. Back then we went with a native .net oodbms system basically because what it allowed us to do was to take our object model and simply add a few persistence related methods(-calls) here and there and we were ready to go. However, over time we ran into more and more caveats, really bad, non-fixable

How to model this multiple inheritance relationship with a RDBMS?

跟風遠走 提交于 2019-12-10 11:12:25
问题 I'm looking at this data model I've come up with and not feeling comfortable. I've changed the entity names so it (hopefully) makes more sense. In any event, how would you model the following? I have 3 entities. GovernmentCustomer, PrivateCustomer, PublicCustomer. Private and Public Customer are both CorporateCustomers. Corporate and Government Customers are Accounts. All Accounts share the same key space (So if PrivateCustomer has a PK of 1 it shouldn't be possible for Public or

which diagram to use in NoSql (Mcd, Merise, UML)

随声附和 提交于 2019-12-10 10:40:00
问题 again, sorry for my silly question, but it seems that what i've learned from Relation Database should be "erased", there is no joins, so how the hell will i draw use Merise and UML in NoSql? http://en.wikipedia.org/wiki/Class_diagram this one will not work for NoSql? 回答1: How you organize your project is an independent notion of the technology used for persistence; In particular; UML or ERD or any such tool doesn't particularly apply to relational databases any more than it does to document

When is MS Access better that a web app backed by RDBMS?

最后都变了- 提交于 2019-12-10 10:16:30
问题 I haven't used Access since high school, years ago. What kind of problem does it solve well, or even better than a web app backed by a real RDBMS? Is it still actively developed? Or is it pretty dead to MS already? What are its biggest limitations? Update: What resource shall one use to learn how to develop a MS Access solution for small business? Thanks 回答1: First and foremost, Access IS a real RDBMS. What it is isn't is a client server RDBMS. The only implications of this are that there is

How do I migrate easily from MySQL to PostgreSQL?

心已入冬 提交于 2019-12-10 10:05:40
问题 I'd like to migrate an existing MySQL database (around 40tables, 400mb data) to Postgres before it gets bigger. I searched the web and tried some migration-scripts (some of them can be found here). None of them works seamlessly - if it would be just a few glitches I had to fix manually, it wouldn't be a problem, but the resulting dumps don't look like valid PostgreSQL at all. Did anybody succeed in migrating a production table without using a full workday - is there an easy solution to that

NoSQL: How to retrieve a 'house' based on lat & long?

时间秒杀一切 提交于 2019-12-09 13:26:46
问题 I have a NoSQL system for storing real estate houses. One piece of information I have in my key-value store for each house is the longitude and latitude . If I wanted to retrieve all houses within a geo-lat/long box, like the SQL below: SELECT * from houses WHERE latitude IS BETWEEN xxx AND yyy AND longitude IS BETWEEN www AND zzz Question: How would I do this type of retrieval with NoSQL ... using just a key-value store system? Even if I could do this with NoSQL, would it even be efficient

Storing conditional logic expressions/rules in a database

让人想犯罪 __ 提交于 2019-12-09 12:36:41
问题 How can I store logical expressions using a RDBMS? I tag objects and would like to be able to build truth statements based on those tags. (These might be considered as virtual tags.) Tags new for_sale used offer Rule second_hand_goods = (!new or used) and for_sale new_offer = new and offer second_hand_offer = second_hand_goods and offer Rules should be able to reference both tags and other rules. Schemas that can be easily accessed by hibernate would be preferrable. Preferably it will be

Studying MySQL, SQLite source code to learn about RDBMS implementation [closed]

☆樱花仙子☆ 提交于 2019-12-09 12:14:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I know implementing database is a huge topic, but I want to have a basic understanding of how database systems work (e.g. memory management, binary tree, transaction, sql parsing, multi-threading, partitions, etc) by investigating the source code of the database. Since there are a few already proven very robust