关系型数据库的核心单元是_核中的数据关系

更新时间:2023-05-16 04:23:45 阅读: 评论:0

关系型数据库的核⼼单元是_核中的数据关系
关系型数据库的核⼼单元是
点亮生命Nucleoid is an open source (Apache 2.0), a runtime environment that provides logical integrity in declarative programming, and at the same time, it stores declarative statements so that it doesn’t require external databa, in short it can be ud as databa.
Nucleoid是⼀个开放源代码(Apache 2.0),它是⼀个运⾏时环境,可在声明式编程中提供逻辑完整性,同时,它存储声明性语句,因此不需要外部数据库,总之可以⽤作数据库。
数据结构 (Data Structure)
维也纳古典乐派Data structures are defined in declarative syntax. Let’s say name is a variable, and by program requirements, name must be:
数据结构以声明性语法定义。 假设name是⼀个变量,并且根据程序要求, name必须为:
less than 10 characters
少于10个字符
first character is upper ca
第⼀个字符为⼤写
contains no underscore character
不含下划线字符
so, this can be 3 parate declarations:
因此,这可以是3个单独的声明:
> if( name.length > 10 ) {
throw "INVALID_SIZE"
文章发型}> if( ! /[A-Z]/.test( name.charAt(0) )) {
throw "INVALID_FIRST_CHARACTER"
}> if( name.indexOf("_") > -1 ) {
throw "INVALID_SPECIAL_CHARACTER"
}
⼈际关系 (Relationships)
Relationships of objects are defined similar to databa’s relationships, but it requires to define in declarative syntax.
对象的关系的定义与数据库的关系类似,但是需要使⽤声明性语法进⾏定义。
⼀对⼀ (One-to-One)
One-to-one’s defined as referring object’s property to another object instance.
⼀对⼀的定义是将对象的属性引⽤到另⼀个对象实例。
> class Driver {}
> class Vehicle {}> driver1 = new Driver();
> vehicle1 = new Vehicle();
> driver1.vehicle = vehicle1;
Bidirectional relationships requires additional declaration in order to keep both side synced, so not recommended unless absolutely required, associative entity may be ud as alternative.
双向关系需要额外的声明才能使双⽅保持同步,因此除⾮绝对必要,否则不建议使⽤关联实体作为替代。
Still all the declarations are applicable to the property:
所有声明仍然适⽤于该属性:
> pe = "CAR"
> pe
"CAR"
⼀对多 (One-to-Many)
One-to-Many is defined in three ways:
⼀对多定义有以下三种⽅式:
列在⾝边 (List as in One’s side)
It is a list created as property:
这是⼀个创建为属性的列表:
> class Customer {}
> class Order {}> ders = [];> customer1 = new Customer();
> order1 = new Order();
> ders.push(order1);缺钙吃什么好
像Manys⼀样的财产 (Property as in Many’s side)
It is a property created, which refers to other instance:
这是⼀个创建的属性,它引⽤其他实例:
> class Employee {}
> class Project {}> employee1 = new Employee()
> project1 = new Project();
> ployee = employee1;
Both of first 2 options are not bidirectional.
前两个选项都不是双向的。
关联实体 (Associative Entity)
In this ca, both objects will be registered in associative object:
在这种情况下,两个对象都将被注册到关联对象中:
> class Ur {}
> class Company {}
> class Registration {}> if ( Registrations.filter( r => r.ur == Ur ).length > 1 ) {
throw "USER_ALREADY_REGISTERED"
}> ur1 = new Ur();
> company1 = new Company();> registration1 = new Registration();
> pany = company1;
> registration1.ur = ur1;
Having a declaration of if ( Registrations.filter( r => r.ur == Ur ).length > 1 ){ .. } adds One-to-Many constraint. In this ca, registering ur1 to another company throws "USER_ALREADY_REGISTERED":
如果声明为if ( Registrations.filter( r => r.ur == Ur ).length > 1 ){ .. }添加⼀对多约束。 在这种情况下,向另⼀家公司注册ur1会引发"USER_ALREADY_REGISTERED" :
> company2 = new Company();
> registration2 = new Registration();
> pany = company2
> registration2.ur = ur1;
> "USER_ALREADY_REGISTERED"
多对多 (Many-to-Many)
Many-to-Many is relatively straightforward as only possible with associative entity without carrying any additional constraint.多对多是相对直接的,只有在没有任何附加约束的情况下,才可能具有关联实体。
> class Pasnger {}
玉髓跟翡翠的区别> class Flight {}
> class Ticket {}> pasnger1 = new Pasnger();
> flight1 = new Flight();> ticket1 = new Ticket();
拉布拉多犬好养吗> ticket1.pasnger = pasnger1
> ticket1.flight = flight1;> flight2 = new Flight();> ticket2 = new Ticket();
> ticket2.pasnger = pasnger1
> ticket2.flight = flight2;
查询 (Queries)
Queries is done with functional programming.
查询是通过函数式编程完成的。
The runtime stores each instance into its class list like driver1 = new Driver() will be part of Drivers.
运⾏时将每个实例存储到其类列表中,例如driver1 = new Driver()将成为Drivers⼀部分。
⼀对⼀ (One-to-One)
> Drivers.filter( d=> d.state == "GA").filter( d => ar > 2010)
/
/ Finds drivers in GA state with car younger than 2010
⼀对多 (One-to-Many)
长大以后做什么> Orders.filter( o => o.price > 100 && o.customer.id == 192)
// Finds orders with bigger than $100 prize of customer with id 192
Other direction
其他⽅向
> Customers.find( c=> c.id == 192).orders.filter( o=>o.price > 100)
多对多 (Many-to-Many)
Tickets.filter( t => t.pasnger.id == 6912 && t.flight.destination == "LA") // Finds ticket of pasnger with id 6912 for destination to FL
参考: :
关系型数据库的核⼼单元是
聚丙烯纤维混凝土

本文发布于:2023-05-16 04:23:45,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/649529.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:关系   声明   关联   数据库   对象   需要   定义   实体
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图