database-schema

database normalization - merge/combine tables

假如想象 提交于 2020-02-07 06:57:54
问题 Please consider the following scenario. We have a 0NF table StudentTeacherTable: StudentName StudentDepartment StudentDepartmentAdd TeacherName TeacherDepartment TeacherDepartmentAdd John CS London Dave Eng, CS Oxford Mike CS London Dave Eng, CS Oxford Chris Eng Oxford Dave Eng, CS Oxford Ideally after normalization I would like to have tables like Student Table: StudentName Department TeacherName John CS Dave Mike CS Dave Chris Eng Dave Teacher Table: Name Dave TeacherDepartment Table:

database normalization - merge/combine tables

孤街醉人 提交于 2020-02-07 06:57:11
问题 Please consider the following scenario. We have a 0NF table StudentTeacherTable: StudentName StudentDepartment StudentDepartmentAdd TeacherName TeacherDepartment TeacherDepartmentAdd John CS London Dave Eng, CS Oxford Mike CS London Dave Eng, CS Oxford Chris Eng Oxford Dave Eng, CS Oxford Ideally after normalization I would like to have tables like Student Table: StudentName Department TeacherName John CS Dave Mike CS Dave Chris Eng Dave Teacher Table: Name Dave TeacherDepartment Table:

Best practice for SQL Server 2008 schema change

扶醉桌前 提交于 2020-01-23 07:42:36
问题 I am looking for information concerning the following: What are the best practices for updating the schema of my dev DB to my production DB, or even more succinctly making DB schema changes in general. The production database is the back-end for two distinct ASP.NET websites. Our schema change process is fairly robust with each "migration" actually being a .cs file containing the schema changes. We will then use ADO.NET to apply the schema changes against the db. My question is more about the

Database table design for scheduling tasks

流过昼夜 提交于 2020-01-19 23:15:46
问题 I want to be able to create schedules that can be executed based on a fixed date, repeated daily, repeated on a particular day of the week, repeated on a particular month of the year, repeated on a particular date every year, and repeated at a particular time of the day. Please how do i go about building the database tables for this problem? Edit #1 Basically, i'm writing an application that allows users to schedule pre-configured greetings to be sent at various pre-configured times. I know i

How do I translate PostgreSQL OID using python

末鹿安然 提交于 2020-01-17 08:31:35
问题 I am having bit of trouble with the psycopg2 Python module. I wrote a small code to extract some information from PostgreSQL table using psycopg2 module. I want to know the data type for each columns in the table: import os, psycopg2, getpass, sys, string userpass = getpass.getpass() # Connect to the database conn = psycopg2.connect("host=hostname dbname=db user=username password=%s" % (userpass)) cur = conn.cursor() cur.execute("SELECT * FROM database.table;") fieldTypes = [desc[1] for desc

Continuous queries in Influxdb ignoring where clause?

无人久伴 提交于 2020-01-17 05:15:42
问题 I'm having a bit of a trouble with the continuous queries in influxdb 0.8.8. I'm trying to create a continuous query but it seems that the where clauses are ignored. I'm aware about the restrictions mentioned here: http://influxdb.com/docs/v0.8/api/continuous_queries.html but I don't consider that this would be the case here. One row in the time series would contain data like this: {"hex":"06a0b6", "squawk":"3421", "flight":"QTR028 ", "lat":99.867630, "lon":66.447365, "validposition":1,

How to Save Multiple Check-boxes data to database?

那年仲夏 提交于 2020-01-15 15:29:51
问题 I am not an expert so I'd really appreciate if you are real specific on your answers. I have this registration form that has a section with lots of check-boxes, and I wondering what the best way is to save this in the database. I am not sure if all values should go to a single column, or If I should create a different table only for this section of my registration form. It's also important to take into account that I will later need to pull all this data from the database and to show it in

How to Save Multiple Check-boxes data to database?

喜你入骨 提交于 2020-01-15 15:29:14
问题 I am not an expert so I'd really appreciate if you are real specific on your answers. I have this registration form that has a section with lots of check-boxes, and I wondering what the best way is to save this in the database. I am not sure if all values should go to a single column, or If I should create a different table only for this section of my registration form. It's also important to take into account that I will later need to pull all this data from the database and to show it in

How to duplicate schemas in PostgreSQL

我的梦境 提交于 2020-01-11 17:29:49
问题 I have a database with schema public and schema_A . I need to create a new schema schema_b with the same structure than schema_a . I found the function below, the problem is that it does not copy the foreign key constraints. CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text) RETURNS void AS $BODY$ DECLARE object text; buffer text; default_ text; column_ text; BEGIN EXECUTE 'CREATE SCHEMA ' || dest_schema ; -- TODO: Find a way to make this sequence's owner is the

Duplicate schema name in sequence generation

空扰寡人 提交于 2020-01-11 13:27:29
问题 To prevent the usage of the schema attribute in the table annotation to all of my entities, I set the default schema name by the schema.xml: <?xml version="1.0" encoding="UTF-8"?> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd" version="2.0"> <persistence-unit-metadata> <persistence-unit-defaults> <schema>X</schema> </persistence-unit-defaults>