Danh mục

Practical Database Programming With Visual C#.NET- P2

Số trang: 50      Loại file: pdf      Dung lượng: 1.29 MB      Lượt xem: 11      Lượt tải: 0    
tailieu_vip

Hỗ trợ phí lưu trữ khi tải xuống: 13,000 VND Tải xuống file đầy đủ (50 trang) 0
Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu practical database programming with visual c#.net- p2, công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
Practical Database Programming With Visual C#.NET- P2 2.11 Create Oracle 10g XE Sample Database 73Figure 2.51 Completed LogIn table.length of the string depends on the number of real letters entered by the user. The datatypes for all columns are VARCHAR2 with one exception, which is the phone columnthat has a CHAR type with an upper bound of 12 letters since our phone numbers arecomposed of 10 digits, and we can extend this length to 12 with two dashes. For all othercolumns, the length varies with the different information, so the VARCHAR2 is selectedfor those columns. The finished design view of your Faculty table is shown in Figure 2.52. You need tocheck the Not Null checkbox for the faculty_id column since we selected this column asthe primary key for this table. Click on the Next button to go to the next page to add the primary key for this table,which is shown in Figure 2.53. Check the Not Populated from the primary key list since we don’t want to use anySequence object to automatically generate a sequence of numeric numbers as our primarykey, and then select the FACULTY_ID(VARCHAR2) from the Primary Key textbox.In this way, the faculty_id column is selected as the primary key for this table. Keep theComposite Primary Key box untouched since we do not have that kind of key in thistable, and click on the Next button to go to the next page. Since we have not created all other tables to work as our reference tables for theforeign key, click on Next to continue, and we will do the foreign key for this table later.Click on the Finish button to go to the Confirm page. Finally click on the Create buttonto create this new Faculty table. Your completed columns in the Faculty table are shownin Figure 2.54.74 Chapter 2 Introduction to DatabasesFigure 2.52 Finished design view of the Faculty table.Figure 2.53 Opened Primary Key window. 2.11 Create Oracle 10g XE Sample Database 75 Figure 2.54 Completed columns in the Faculty table.Table 2.24 Data in the Faculty Table faculty_id faculty_name office phone college title emailA52990 Black Anderson MTC-218 750-378-9987 Virginia Tech Professor banderson@college.eduA77587 Debby Angles MTC-320 750-330-2276 University of Chicago Associate Professor dangles@college.eduB66750 Alice Brown MTC-257 750-330-6650 University of Florida Assistant Professor abrown@college.eduB78880 Ying Bai MTC-211 750-378-1148 Florida Atlantic University Associate Professor ybai@college.eduB86590 Satish Bhalla MTC-214 750-378-1061 University of Notre Dame Associate Professor sbhalla@college.eduH99118 Jeff Henry MTC-336 750-330-8650 Ohio State University Associate Professor jhenry@college.eduJ33486 Steve Johnson MTC-118 750-330-1116 Harvard University Distinguished Professor sjohnson@college.eduK69880 Jenney King MTC-324 750-378-1230 East Florida University Professor jking@college.edu Now click on the Data object tool to add the data into this new table. Click on the Insert Row button to add all rows that are shown in Table 2.24 into this table. Click on the Create and Create Another button when the first row is done, and con- tinue to create all rows with the data shown in Table 2.24. You may click on the Create button for your last row. Your finished Faculty table should match the one shown in Figure 2.55. 2.11.2.3 Create Other Tables In a similar way, you can continue to create the following three tables: Course, Student, and StudentCourse based on the data shown in Tables 2.25, 2.26, and 2.27.76 Chapter 2 Introduction to DatabasesFigure 2.55 Finished Faculty table. The data types used in the Course table are: • course_id: VARCHAR2(10)—primary Key • course: VARCHAR2(40) • credit: NUMBER(1, 0)—precision = 1, scale = 0 (1-bit integer) • classroom: CHAR(6) • schedule: VARCHAR2(40) • enrollment: NUMBER(2, 0)—precision = 2, scale = 0 (2-bit integer) • faculty_id: VARCHAR2(10) The data types used in the Student table are: • student_id: VARCHAR2(10)—primary Key • student_name: VARCHAR2(20) • gpa: NUMBER(3, 2)—precision = 3, scale = 2 (3-bit floating point data with 2-bit after the decimal point) • credits: NUMBER(3, 0)—precision = 3, scale = 0 (3-bit integer) • major: VARCHAR2(40) • schoolYear: VARCHAR2(20) • email: VARCHAR2(20) The data types used in the StudentCourse table are: • s_course_id: NUMBER(4, 0)—precision = 4, scale = 0 (4-bit integer) primary key • student_id: VARC ...

Tài liệu được xem nhiều: