database-schema

How to insert current date in row's column

笑着哭i 提交于 2019-12-23 10:54:15
问题 How do I insert current date into a row's column in the "Edit data" view in MS SqlServer Mgm Studio? I want to get the equivalent value of GetDate() function call. Here's an image which I hope clarifies the question: 回答1: you can not type function so type the date or one of following solution Create a default GetDate() on the modificationddate column on your table. Create a update trigger that update modificationddate column when data changes in the row. 来源: https://stackoverflow.com

How to insert current date in row's column

戏子无情 提交于 2019-12-23 10:54:10
问题 How do I insert current date into a row's column in the "Edit data" view in MS SqlServer Mgm Studio? I want to get the equivalent value of GetDate() function call. Here's an image which I hope clarifies the question: 回答1: you can not type function so type the date or one of following solution Create a default GetDate() on the modificationddate column on your table. Create a update trigger that update modificationddate column when data changes in the row. 来源: https://stackoverflow.com

MySQL - Should I use multi-column primary keys on every child table?

随声附和 提交于 2019-12-23 04:28:27
问题 Setup: I was trying to understand the difference between identifying and non-identifying relationships when I found this great article on stackexchange. What's the difference between identifying and non-identifying relationships? After reading a few comments it brought another question to mind about a problem I have been having. Question: Should I use multi-column primary keys on every child table and what are the advantages/disadvantages to doing so? To better illustrate my question I have

Why is a specific cardinality not allowed in the ERD?

元气小坏坏 提交于 2019-12-22 18:30:49
问题 In every tutorial on entity relationship diagrams, I read that specifying a fixed cardinality for a relationship is not allowed. Only an informal comment on the ERD may clarify that the number of pilots is exactly 2 . So, for example, a relationship between flights and pilots where each flight has exactly 2 pilots present, would have to be represented as: <flight> 0..N <------> 1..N <pilot> rather than <flight> 0..N <------> 2 <pilot> My notation is 0..N = optional, many; 1..N = mandatory,

Marking deleted records in DB tables

泄露秘密 提交于 2019-12-22 11:35:36
问题 Sometimes you want to mark a DB table record as deleted instead of deleting it permanently, right? How do you do that? So far I've been using a boolean "deleted" field but I'm not sure if it's a good apprach. 回答1: That's about it - a boolean field to indicate that the record is deleted. The few times I used that, I called that field IsDeleted . This is often referred to as Logical Delete . It's up to you to respect that field in your reports - which means excluding all the records with

Mongoose behavior and schema

梦想的初衷 提交于 2019-12-22 04:43:40
问题 I am learning nodejs along with mongodb currently, and there are two things that confuse me abit. (1), When a new Schema and model name are used (not in db), the name is changed into its plural form. Example: mongoose.model('person', personSchema); in the database, the table will be called "people" instead. Isn't this easy to confuse new developer, why has they implemented it this way? (2), Second thing is that whenever I want to refer to an existing model in mongoDb (assume that in db, a

Implementing an efficient system of “unread comments” counters

强颜欢笑 提交于 2019-12-22 04:10:40
问题 I am trying to find an optimal solution for the following problem: there is a need to design a database (postgres-based), the system of triggers and counters in it, which will form a system of efficiently querying, updating and storing information on 'how much unread comments exist in each article (or blog entry, or smth. similar), that is displayed on the page'. Every solution that comes to the head, has some serious disadvantages, either in querying, or the storing, or the updating part. I

Get database schema with one query?

依然范特西╮ 提交于 2019-12-22 04:09:19
问题 Basically I want to get the table names, and the field names for each table from the current database that is connected, nothing else. Is this possible? I know that SHOW TABLES FROM my_database gets you the table names, and SHOW COLUMNS FROM my_table will get you the fields, but that's at least [1 x # of tables] queries and I get more information that I want :) 回答1: The INFORMATION_SCHEMA.COLUMNS table has what you're asking for. SELECT table_name, column_name FROM INFORMATION_SCHEMA.COLUMNS

How to SELECT in Oracle using a DBLINK located in a different schema?

匆匆过客 提交于 2019-12-21 07:27:31
问题 We have an Oracle DBMS (11g) and the following configuration: A DB user "MYUSER" Two schemas "MYUSER" and "SCHEMA_B" User "MYUSER" can access "SCHEMA_B" and has READ permissions on its tables A public DB link "DB_LINK" located in "SCHEMA_B" The DB_LINK is working when using the DB user "SCHEMA_B" directly Question : When logged on as "MYUSER", what is the correct syntax to access tables using the DB link of "SCHEMA_B"? Is it possible to do so at all? I already tried several constellations,

DB Schema for Appointment Booking App: What is the correct relationship between Doctors, Appointments, TimeSlots, Patients?

依然范特西╮ 提交于 2019-12-21 06:31:05
问题 [ UPDATED SCHEMA: http://i.imgur.com/fX9CGNh.png ] I'm tasked with developing an appointment booking system that is designed for a small medical office. It is a Rails 3.2 app. I'm having difficulty designing a database schema that makes sense to me. Question: Given the following information, what is the correct relationship between doctors, patients, appointments, chairs and time_slots? Patients need to make appointments with a doctor's office. Depending on the type of appointment, each