无法弄清楚这些错误。我一直在努力,请帮忙,我已经坚持了大约4个小时。
CREATE TABLE Student
(
student_id varchar(25),
student_name varchar(25),
major varchar(10),
gpa number(3,2),
PRIMARY KEY(student_id)
);
CREATE TABLE Class
(
schedule_num varchar(25),
semester varchar(25),
course_name varchar(25),
course_number varchar(25),
credit varchar(4),
department varchar(25),
meeting_time varchar(25),
meeting_place varchar(25),
class_size_limit varchar (25),
PRIMARY KEY(schedule_num,semester)
);
CREATE TABLE Enrolls
(
semester varchar(25),
grade varchar(2),
PRIMARY KEY(student_id,schedule_num,semester),
student_id varchar(25) FOREIGN KEY REFERENCES Student(student_id),
schedule_num varchar(25) FOREIGN KEY REFERENCES Class(schedule_num),
);

2个错误---
1)错误 - 错过右边线6 2)错误 - 表格或视图不存在第1行
答案 0 :(得分:1)
在Oracle中,您应该使用import java.util.Scanner;
public class jtwalsh_LeetLoop {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int total;
int counter;
counter = 1;
System.out.print( "How many characters would you like to test? ");
int total = input.nextInt();
while ( counter <= total)
System.out.print( "Enter a character to test: " );
char ch;
ch = input.next() .charAt(0);}
counter = counter"";
switch ( ch ) {
case 'a': case 'A':
System.out.printf( "%c @\n", ch );
break;
case 'b': case 'B':
System.out.printf( "%c I3\n", ch );
break;
case 'c': case 'C':
System.out.printf( "%c <\n", ch );
break;
case 'd': case 'D':
System.out.printf( "%c [)\n", ch );
break;
case 'e': case 'E':
System.out.printf( "%c &\n", ch );
break;
case 'f': case 'F':
System.out.printf( "%c ]=\n", ch );
break;
case 'g': case 'G':
System.out.printf( "%c 6\n", ch );
break;
而不是varchar2()
(出于非常神秘和历史原因)。
定义外键和主键时:
varchar()
关键字不使用references
。Here是一个修复这些问题的SQL小提琴:
foreign key
答案 1 :(得分:0)
您在第二行的末尾添加了一个额外的逗号。 schedule_num varchar(25)FOREIGN KEY REFERENCES类(schedule_num),
该逗号可能导致错误。