CREATE TABLE SalaryInfo ( ID INT PRIMARY KEY, EmployeeID INT NOT NULL, Salary DECIMAL(10, 2) NOT NULL, StartDate DATE NOT NULL, EndDate DATE, FOREIGN KEY (EmployeeID) REFERENCES EmployeeInfo(ID) );
时间: 2023-12-06 22:02:19 浏览: 136
好的,以下是五条示例数据插入:
```
INSERT INTO SalaryInfo (ID, EmployeeID, Salary, StartDate, EndDate) VALUES (1, 1001, 5000.00, '2021-01-01', NULL);
INSERT INTO SalaryInfo (ID, EmployeeID, Salary, StartDate, EndDate) VALUES (2, 1002, 7000.00, '2021-01-01', NULL);
INSERT INTO SalaryInfo (ID, EmployeeID, Salary, StartDate, EndDate) VALUES (3, 1003, 10000.00, '2021-01-01', NULL);
INSERT INTO SalaryInfo (ID, EmployeeID, Salary, StartDate, EndDate) VALUES (4, 1004, 8000.00, '2021-01-01', NULL);
INSERT INTO SalaryInfo (ID, EmployeeID, Salary, StartDate, EndDate) VALUES (5, 1005, 6000.00, '2021-01-01', NULL);
```
请注意,这是示例数据,实际应用中的数据可能会有所不同。
相关问题
CREATE TABLE EmployeeInfo ( ID INT PRIMARY KEY, Name VARCHAR(50) NOT NULL, Gender VARCHAR(10) NOT NULL, Birthday DATE, Department VARCHAR(50), Position VARCHAR(50), HireDate DATE, Salary DECIMAL(10, 2), Phone VARCHAR(20), Email VARCHAR(50) ); CREATE TABLE SalaryInfo ( ID INT PRIMARY KEY, EmployeeID INT NOT NULL, Salary DECIMAL(10, 2) NOT NULL, StartDate DATE NOT NULL, EndDate DATE, FOREIGN KEY (EmployeeID) REFERENCES EmployeeInfo(ID) ); CREATE TABLE AttendanceInfo ( ID INT PRIMARY KEY, EmployeeID INT NOT NULL, AttendanceDate DATE NOT NULL, SignTime DATETIME, LeaveTime DATETIME, FOREIGN KEY (EmployeeID) REFERENCES EmployeeInfo(ID) ); CREATE TABLE WelfareInfo ( ID INT PRIMARY KEY, EmployeeID INT NOT NULL, WelfareType VARCHAR(50) NOT NULL, WelfareAmount DECIMAL(10, 2) NOT NULL, WelfareDate DATE NOT NULL, FOREIGN KEY (EmployeeID) REFERENCES EmployeeInfo(ID) ); CREATE TABLE DepartmentInfo ( ID INT PRIMARY KEY, DepartmentName VARCHAR(50) NOT NULL, ManagerID INT, Description VARCHAR(200) );
好的,以下是向AttendanceInfo表插入五条内容的SQL语句示例:
INSERT INTO AttendanceInfo(ID, EmployeeID, AttendanceDate, SignTime, LeaveTime) VALUES (1, 1001, '2021-07-01', '2021-07-01 09:00:00', '2021-07-01 18:00:00');
INSERT INTO AttendanceInfo(ID, EmployeeID, AttendanceDate, SignTime, LeaveTime) VALUES (2, 1001, '2021-07-02', '2021-07-02 09:10:00', '2021-07-02 18:00:00');
INSERT INTO AttendanceInfo(ID, EmployeeID, AttendanceDate, SignTime, LeaveTime) VALUES (3, 1002, '2021-07-01', '2021-07-01 09:05:00', '2021-07-01 18:30:00');
INSERT INTO AttendanceInfo(ID, EmployeeID, AttendanceDate, SignTime, LeaveTime) VALUES (4, 1002, '2021-07-02', '2021-07-02 09:20:00', '2021-07-02 18:20:00');
INSERT INTO AttendanceInfo(ID, EmployeeID, AttendanceDate, SignTime, LeaveTime) VALUES (5, 1003, '2021-07-01', '2021-07-01 09:15:00', '2021-07-01 18:15:00');
注意,在实际插入数据时,你需要根据自己的表结构和具体需要进行调整和修改。
CREATE TABLE CUSTOMER ( CustomerID NUMBER(10) PRIMARY KEY, FirstName VARCHAR2(50), LastName VARCHAR2(50), Email VARCHAR2(100), PhoneNumber VARCHAR2(20) ); 1.创建ORDER表: CREATE TABLE Orders ( OrderID NUMBER(10) PRIMARY KEY, OrderDate DATE, OrderStatus VARCHAR2(20), TotalCost NUMBER(10,2), CustomerID NUMBER(10), FOREIGN KEY (CustomerID) REFERENCES CUSTOMER(CustomerID) ); 1.创建PRODUCT表: CREATE TABLE PRODUCT ( ProductID NUMBER(10) PRIMARY KEY, ProductName VARCHAR2(100), Description VARCHAR2(500), Price NUMBER(10,2), Category VARCHAR2(50) ); 1.创建ORDER_DETAILS表: CREATE TABLE ORDER_DETAILS ( OrderDetailID NUMBER(10) PRIMARY KEY, ProductName VARCHAR2(100), Price NUMBER(10,2), Quantity NUMBER(10), Subtotal NUMBER(10,2), OrderID NUMBER(10), ProductID NUMBER(10), FOREIGN KEY (OrderID) REFERENCES ORDERS(OrderID), FOREIGN KEY (ProductID) REFERENCES PRODUCT(ProductID) ); 1.创建STORE表: CREATE TABLE STORE ( StoreID NUMBER(10) PRIMARY KEY, StoreName VARCHAR2(100), Location VARCHAR2(200), HoursOfOperation VARCHAR2(200) ); 1.创建INVENTORY表: 1.CREATE TABLE INVENTORY ( ProductID INT NOT NULL, StoreID INT NOT NULL, Quantity INT NOT NULL, ReorderPoint INT NOT NULL, PRIMARY KEY (ProductID, StoreID), CONSTRAINT fk_product FOREIGN KEY (ProductID) REFERENCES Product(ProductID), CONSTRAINT fk_store FOREIGN KEY (StoreID) REFERENCES Store(StoreID) ); 2.创建TRANSACTION表: CREATE TABLE TRANSACTION ( TransactionID NUMBER(10) PRIMARY KEY, TransactionDate DATE, TransactionType VARCHAR2(20), TotalAmount NUMBER(10,2), CustomerID NUMBER(10), FOREIGN KEY (CustomerID) REFERENCES CUSTOMER(CustomerID) ); 1.创建TRANSACTION_DETAILS表: CREATE TABLE TRANSACTION_DETAILS ( TransactionDetailID NUMBER(10) PRIMARY KEY, ProductName VARCHAR2(100), Price NUMBER(10,2), Quantity NUMBER(10), Subtotal NUMBER(10,2), TransactionID NUMBER(10), ProductID NUMBER(10), FOREIGN KEY (TransactionID) REFERENCES TRANSACTION(TransactionID), FOREIGN KEY (ProductID) REFERENCES PRODUCT(ProductID) ); 1.创建EMPLOYEE表: CREATE TABLE EMPLOYEE ( EmployeeID NUMBER(10) PRIMARY KEY, Name VARCHAR2(100), Address VARCHAR2(200), PhoneNumber VARCHAR2(20), Email VARCHAR2(100), Position VARCHAR2(50) ); 1.创建SALARY表: CREATE TABLE SALARY ( EmployeeID NUMBER(10), StartDate DATE, EndDate DATE, SalaryAmount NUMBER(10,2), PRIMARY KEY (EmployeeID, StartDate), FOREIGN KEY (EmployeeID) REFERENCES EMPLOYEE(EmployeeID) ); 1.创建SHIFT表: CREATE TABLE SHIFT ( ShiftID NUMBER(10) PRIMARY KEY, StartTime DATE, EndTime DATE, StoreID NUMBER(10), EmployeeID NUMBER(10), FOREIGN KEY (StoreID) REFERENCES STORE(StoreID), FOREIGN KEY (EmployeeID) REFERENCES EMPLOYEE(EmployeeID) );写出导出这些表的数据字典的oracle语句
Oracle中可以使用以下语句导出数据字典:
SELECT table_name, column_name, data_type, data_length, nullable
FROM user_tab_columns
WHERE table_name IN ('CUSTOMER', 'ORDERS', 'PRODUCT', 'ORDER_DETAILS', 'STORE', 'INVENTORY', 'TRANSACTION', 'TRANSACTION_DETAILS', 'EMPLOYEE', 'SALARY', 'SHIFT')
ORDER BY table_name, column_id;
这将查询指定表的列信息,并按表名和列ID排序。可以将查询结果导出为CSV或Excel文件以获取数据字典。
阅读全文