rdbms

Properly Formatting Tables in SQLPLUS

北城以北 提交于 2019-12-24 10:26:35
问题 Before this gets voted as a duplicate question, I have spent quite some time on S.O. trying to fix this. As you can see in the screenshot below, my tables are looking messy. For the first and second table, you can see how there are 2 sets of column headings for each table. So how can I, for example, get all 5 customer records to be included in one table? The other thing I can't figure out is how to get the column headers to be properly formatted(not truncated and all on the same row). *I have

What's the relationship between the two entities?

丶灬走出姿态 提交于 2019-12-24 09:08:02
问题 The ER diagram for a database is given below: Now, what's the relationship between planes and flights entities? I'd say one to many, but that'd be wrong because while one plane can have more than one flights, many flights can't have one (single) plane simultaneously. So, what exactly is the relationship? I'm new to databases. Please tell me if I'm wrong. 回答1: First, your diagram isn't an ER diagram, it's a table diagram. ER diagrams must be able to represent the ER model, which supports

What is the best data type to store boolean values in a database

こ雲淡風輕ζ 提交于 2019-12-23 21:15:26
问题 What is the best data type to store boolean values in a database? which is supported by mostly used RDBMS types such as Mysql,oracle,postgres,mssql 回答1: you can use TINYINT or bit datatype 回答2: If the DBMS supports a real boolean type (e.g. PostgreSQL) then use that. If it doesn't I usually prefer an integer value combined with a check constraint that ensures that only 0 and 1 can be stored. In my experience it also makes sense to define the column as NOT NULL as well. Having a NULL value for

Alternatives of Join in MongoDB

╄→гoц情女王★ 提交于 2019-12-23 06:56:14
问题 I am new in mongoDB. I am facing Problem with mongoDB. That is " How do i give relationship between two collections in mongoDB? " I read manual of mongoDB that mention mongoDB is not a RDBMS and mongoDB is not support Any kind of JOINS. But i want to know Alternatives of JOINS in mongoDB. 回答1: From MongoDb v3.2 , new $lookup operator was introduced to perform joins in MongoDb . This works as sql left join and its documentation can be found at https://docs.mongodb.com/master/reference/operator

How is Oracle ACID compliant when it does not honour 'isolation' property fully?

[亡魂溺海] 提交于 2019-12-23 04:35:45
问题 Claim: Oracle does not honour isolation property in ACID properties. As per Wikipedia page on ACID "Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially." This can happen only if the transactions are serializable. Yes, Oracle has a transaction level called Serializable but it is not true serializability and is only snapshot isolation. Read https://blog.dbi-services.com

How to extract database name from connection string irrespective of RDBMS?

北城以北 提交于 2019-12-23 04:19:29
问题 I am working on the class which is not aware about the RDBMS being used. Of-course, rest of the application is well aware about it. Connection string is input to this class. I need database name. How can I extract database name from connection string irrespective of RDBMS? I read following question: How to get Database Name from Connection String using SqlConnectionStringBuilder Extract properties of sql connection string Following approaches are suggested there: Use Connection String Builder

Migrate RDBMS to Cassandra

断了今生、忘了曾经 提交于 2019-12-23 02:36:45
问题 I have a RDBMS database with the following tables: Airport ( iata PK , airport, city, state, country, lat, long) cancellation_cause ( cod_cancellation PK , description) Manufaturer (id_manufacturer PK , manufacturer_name) Model (id_model PK , model_name, id_manufacturer FK ) Airline ( airline_code PK , description) airplane_type (id_AirplaneType PK , airplane_type) engine_type (id_engine PK , engine_type) Aircraft_type (id_aircraft PK , aircraft_type) Airplane (TailNumber PK , id_model FK, id

Do numerical primary keys of deleted records in a database get reused for future new records?

落爺英雄遲暮 提交于 2019-12-22 06:48:28
问题 For example if I have an auto-numbered field, I add new records without specifying this field and let DB engine to pick it for me. So, will it pick the number of the deleted record? If yes, when? // SQL Server, MySQL. // Follow-up question: What happens when DB engine runs out of numbers to use for primary keys? 回答1: NO. numerical primary keys will not reused, except you specify them manually(you should really avoid this!) 回答2: AFAIK, this could happen in MySQL: How AUTO_INCREMENT Handling

Keeping one table or multiple table for similar type of data which one is best while considering high performance

帅比萌擦擦* 提交于 2019-12-21 23:01:06
问题 I am designing DATABASE for a Sales and Purchase application like ERP and using MYSQL as RDBMS, I have doubt on creating table for sales and purchase entities to go with single table for each module(Sale/Purchase) or multiple tables for each entities(Sales order, Sale invoice, Sale return, Purchase order, Purchase invoice, Purchase return) in longer run. Below is my use case. My application will have Sale Order, Sale Delivery, Sale Invoice, Sale Return and Credit Note and same entity for

How can I check if the table behind a synonym exists

一个人想着一个人 提交于 2019-12-21 16:32:11
问题 I'm trying to create a simple script to dump the results of a complex view out into a table for reporting. I have used synonyms to simplify tweaking the view and table names. The idea is that the user of the script can put the name of the view they want to use as the source, and the name of the target reporting table in at the start and away they go. If the table doesn't exist then the script should create it. If the table already exists then the script should only copy the records from the