12 regras de Codd
As Doze regras de Codd são um conjunto de treze regras (enumeradas de zero à doze) propostas por Edgar F. Codd, um pioneiro do modelo relacional para banco de dados, designado para definir o que é necessário para que um sistema de gerenciamento de banco de dados para ser considerado relacional.[1][2] They are sometimes jokingly referred to as "Codd's Twelve Commandments".
Codd criou estas regras como parte de uma campanha pessoal para impedir que a sua visão de banco de dados relacional fosse diluída, como fornecedores de banco de dados embaralhados no início de 1980 para remontar produtos existentes com um verniz relacional. A regra 12 foi especialmente criada para combater este posicionamento dos fornecedores.
[editar] As regras
Regra (0): O sistema precisa ser qualificado como relacional, como um banco de dados, e como um sistema de gerenciamento.
- Para um sistema para se qualificar como um sistema de gerenciamento de banco de dados relacional (SGBD), este sistema precisa usar suas facilidades de relacionamento (exclusivamente) para gerenciar o banco de dados.
Regra 1: A regra da informação:
- Todas as informações no banco de dados necessitam estar representadas de apenas uma forma, nomeados por valores em posições de colunas dentro de registros de tabelas.
Regra 2: A regra de acesso garantido:
- Todos os dados necessitam ser acessíveis. Esta regra é essencialmente uma reafirmação do requisito fundamental para chaves primárias. Diz que todo valor na base de dados necessita ser logicamente endereçavel por um nome específico do conteúdo tabela, o nome do conteúdo da coluna e o valor da chave primária do conteúdo registro.
Regra 3: Tratamento sistemático de valores nulos::
- O SGBD deve permitir que cada campo possa permanecer nulo (ou vazio). Especificamente, ele deve suportar uma representação de "falta de informação e informações inaplicáveis" que é sistemática, diferente de todos os valores regulares (oor exemplo, "diferente de zero ou qualquer outro número", no caso de valores numéricos), e independente de tipo de dados. É também implícito que tais representações devem ser manipuladas pelo SGBD de maneira sistemática.
Regra 4: Active online catalog based on the relational model:
- The system must support an online, inline, relational catalog that is accessible to authorized users by means of their regular linguagem de consulta. That is, users must be able to access the database's structure (catalog) using the same query language that they use to access the database's data.
Regra 5: The comprehensive data sublanguage rule:
- The system must support at least one relational language that
-
- Has a linear syntax
- Can be used both interactively and within application programs,
- Supports data definition operations (including view definitions), data manipulation operations (update as well as retrieval), security and integrity constraints, and transaction management operations (begin, commit, and rollback).
-
Regra 6: The view updating rule:
- All views that are theoretically updatable must be updatable by the system.
Regra 7: High-level insert, update, and delete:
- The system must support set-at-a-time insert, update, and delete operators. This means that data can be retrieved from a relational database in sets constructed of data from multiple rows and/or multiple tables. This rule states that insert, update, and delete operations should be supported for any retrievable set rather than just for a single row in a single table.
Regra 8: Physical data independence:
- Changes to the physical level (how the data is stored, whether in arrays or linked lists etc.) must not require a change to an application based on the structure.
Regra 9: Logical data independence:
- Changes to the logical level (tables, columns, rows, and so on) must not require a change to an application based on the structure. Logical data independence is more difficult to achieve than physical data independence.
Regra 10: Integrity independence:
- Integrity constraints must be specified separately from application programs and stored in the catalog. It must be possible to change such constraints as and when appropriate without unnecessarily affecting existing applications.
Regra 11: Distribution independence:
- The distribution of portions of the database to various locations should be invisible to users of the database. Existing applications should continue to operate successfully:
-
- when a distributed version of the DBMS is first introduced; and
- when existing distributed data are redistributed around the system.
-
Regra 12: The nonsubversion rule:
- If the system provides a low-level (record-at-a-time) interface, then that interface cannot be used to subvert the system, for example, bypassing a relational security or integrity constraint.