Questions tagged [database]

A database is an organized collection of data. It is the collection of schemas, tables, queries, reports, views, and other objects. The data are typically organized to model aspects of reality in a way that supports processes requiring information. Use this tag if you have questions about designing a database. If it is about a particular database management system, (e.g., MySQL), please use that tag instead.

From Wikipedia:

A database is an organized collection of data. It is the collection of tables, queries, reports, views and other objects. The data is typically organized to model aspects of reality in a way that supports processes requiring information, such as modelling the availability of rooms in hotels in a way that supports finding a hotel with vacancies.

A large proportion of websites and applications rely on databases. They are a crucial component of telecommunications systems, banking systems, video games, and just about any other software system or electronic device that maintains some amount of persistent information. In addition to persistence, database systems provide a number of other properties that make them exceptionally useful and convenient: reliability, efficiency, scalability, concurrency control, data abstraction, and high-level query languages. Databases are so ubiquitous and important that computer science graduates frequently cite their database class as the one most useful to them in their industry or graduate-school careers.2

The term database should not be confused with Database Management System (DBMS). A DBMS is the system software used to create and manage databases and provide users and applications with access to the database(s). A database is to a DBMS as a document is to a word processor.

Database Languages

Database languages are special-purpose languages, which do one or more of the following:

###ACID In computer science, ACID (Atomicity, Consistency, Isolation, Durability) is a set of properties of database transactions.

  1. Atomicity - Atomicity requires that each transaction be "all or nothing": if one part of the transaction fails, then the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes. To the outside world, a committed transaction appears (by its effects on the database) to be indivisible ("atomic"), and an aborted transaction does not happen.

  2. Consistency - The consistency property ensures that any transaction will bring the database from one valid state to another. Any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof. This does not guarantee correctness of the transaction in all ways the application programmer might have wanted (that is the responsibility of application-level code) but merely that any programming errors cannot result in the violation of any defined rules.

  3. Isolation - The isolation property ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed serially, i.e., one after the other. Providing isolation is the main goal of concurrency control. Depending on the concurrency control method (i.e., if it uses strict - as opposed to relaxed - serializability), the effects of an incomplete transaction might not even be visible to another transaction.

  4. Durability - The durability property ensures that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be stored permanently (even if the database crashes immediately thereafter). To defend against power loss, transactions (or their effects) must be recorded in a non-volatile memory.

A few notable DBMSs:

Popular Database tools

Some useful references:

Free online database courses:

193843 questions
36
votes
13 answers

Selecting most recent date between two columns

If I have a table that (among other columns) has two DATETIME columns, how would I select the most recent date from those two columns. Example: ID Date1 Date2 1 1/1/2008 2/1/2008 2 2/1/2008 1/1/2008 3 1/10/2008 …
TheTXI
  • 37,429
  • 10
  • 86
  • 110
36
votes
3 answers

How to clean or resize the ibtmp1 file in MySQL?

MySQL 5.7 introduces a new file ibtmp1 for storing temporary data in InnoDB to increase the performance. But I have noted that its size increases continuously. On my db server its sizes increases to 92GB. Is there any way of reducing size or…
Aman Aggarwal
  • 17,619
  • 9
  • 53
  • 81
36
votes
2 answers

How to update all columns with INSERT ... ON CONFLICT ...?

I have a table with a single primary key. When I attempt to do an insert there may be a conflict caused by trying to insert a row with an existing key. I want to allow the insert to update all columns? Is there any easy syntax for this? I am trying…
beatsforthemind
  • 879
  • 2
  • 8
  • 17
36
votes
4 answers

What is the MariaDB dialect class name for Hibernate?

In Hibenate I am using MariaDB but I couldn't find the dialect class name of MariaDB . In Hibernate, MySQL5 dialect's name is org.hibernate.dialect.MySQL5Dialect For Oracle 10g
Bijaya Bhaskar Swain
  • 893
  • 1
  • 11
  • 16
36
votes
3 answers

How are bitmap indexes helpful?

Wikipedia gives this example Identifier Gender Bitmaps F M 1 Female 1 0 2 Male 0 1 3 Male 0 1 4 Unspecified 0 …
Moeb
  • 10,527
  • 31
  • 84
  • 110
36
votes
8 answers

When should I use Oracle's Index Organized Table? Or, when shouldn't I?

Index Organized Tables (IOTs) are tables stored in an index structure. Whereas a table stored in a heap is unorganized, data in an IOT is stored and sorted by primary key (the data is the index). IOTs behave just like “regular” tables, and you use…
Mr. Red
  • 361
  • 1
  • 3
  • 3
36
votes
10 answers

Move models between Django (1.8) apps with required ForeignKey references

This is an extension to this question: How to move a model between two Django apps (Django 1.7) I need to move a bunch of models from old_app to new_app. The best answer seems to be Ozan's, but with required foreign key references, things are bit…
Shreyas
  • 363
  • 3
  • 7
36
votes
11 answers

How to change the default port of mysql from 3306 to 3360

I want to change the default port number of MySQL server presently it is 3306. I want to change it to 3360. I have tried: -- port=3360 But things are not working for me. Please provide query to change port not any configuration. I am using Windows…
programminglover
  • 753
  • 3
  • 10
  • 20
36
votes
5 answers

Cassandra - transaction support

I am going through apache cassandra and working on sample data insertion, retrieving etc. The documentation is very limited. I am interested in knowing can we completely replace relation db like mysql/ oracle with cassandra? does cassandra support…
Kumar D
  • 1,308
  • 5
  • 19
  • 43
36
votes
6 answers

How to detect a SQL Server database's read-only status using T-SQL?

I need to know how to interrogate a Microsoft SQL Server, to see if a given database has been set to Read-Only or not. Is that possible, using T-SQL?
Giuseppe
  • 625
  • 1
  • 9
  • 15
36
votes
3 answers

How to know which storage engine is used in mongodb?

Starting from version 3.0, mongodb support pluggable storage engine. How to know which storage engine is being used in a system?
Mayank Patel
  • 8,088
  • 5
  • 55
  • 75
36
votes
6 answers

best event sourcing db strategy

I want to setup a small event sourcing lib. I read a few tutorials online, everything understood so far. The only problem is, in these different tutorials, there are two different database strategies, but without any comments why they use the one…
SharpNoiZy
  • 1,099
  • 2
  • 11
  • 22
36
votes
6 answers

INET_ATON() and INET_NTOA() in PHP?

I want to store IP addresses in my database, but I also need to use them throughout my application. I read about using INET_ATON() and INET_NTOA() in my MySQL queries to get a 32-bit unsigned integer out of an IP address, which is exactly what I…
blerh
  • 531
  • 3
  • 6
  • 8
36
votes
3 answers

Unique (multiple columns) and null in one column

I have simple categories table. Category can have parent category (par_cat column) or null if it is main category and with the same parent category there shouldn't be 2 or more categories with the same name or url. Code for this table: CREATE TABLE…
Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
36
votes
4 answers

Guice, JDBC and managing database connections

I'm looking to create a sample project while learning Guice which uses JDBC to read/write to a SQL database. However, after years of using Spring and letting it abstract away connection handling and transactions I'm struggling to work it our…
pledge
  • 1,054
  • 3
  • 12
  • 17
1 2 3
99
100