121.1DBDatabase),DBDBDBMSDatabaseManagementSystem)DBMSDBDBDBMSDBMSDBSDatabaseSystem),DBS11E1E2E1E2111NE1E2E2E1E1E21NMNE1E2E1E2MN////hostlanguage),DDLDataDefinitionLanguage),DMLDataManipulationLanguage),DMLDMLDMLDMLDMLDMLDMLDMLDMLDMLDMLDMLDMLDMLDMLDDDataDictionary),DDDDDDDD1.21redundancy)2inconsistency)3(poordatarelationship)1.3123451.4entity)attribute):field):record):2.22.3ERERP1P2ERP1P22.4ERER12MNMN1N2.72.92.11DBMSDBMS1234562.12DBMSDBMS12342.13DBMSDBMS1(loading)2(backup)342.14DBMSDBMS1DDLDMLDML22.15DBSDBS2.17DBADBADBADBADBSDBADBA123DBA123452.19DBSDBS1DBA2343.1:SSC,S#SS#SCS#SCKR1KR2R2KR11)2)R1R23)PascalC3.2?3.3?3.4?1)2)()3)4)3.5?RSi(r+j)()S3.8RS1,5(2=43=4(RS))(1)(2)(3)(1)R23415(2){t|(u)(v)(R(u)S(v)(u[2]=v[4]u[3]=v[4])t[1]=u[1]t[2]=v[2])}(3):{xv|(y)(z)(u)(R(xyz)S(uv)(y=uz=u))}3.10{ab|R(ab)R(ba)}(1)(2)(3)(1)R12R(2)12(1=42=3(RR))(3){t|(u)(R(t)R(u)t[1]=u[2]t[2]=u[1])}3.11R(ABC)S(DEF)(1)A(R)(2)B='17'(R)(3)RS(4)A,F(C=D(RS))(1){t|(u)(R(t)R(u)t[1]=u[1])}(2){t|R(t)t[2]='17')}(3){t|(u)(v)(R(u)S(v)t[1]=u[1]t[2]=u[2]t[3]=u[3]t[4]=v[1]t[5]=v[2]t[6]=v[3])}(4){t|(u)(v)((R(u)S(v)u[3]=v[4]t[1]u[1]t[2]=v[3])}3.12S(S#,SNAME,AGE,SEX)SC(S#,C#,GRADE)C(C#,CNAME,TEACHER)3.13()(1)LIUC#,CNAME(TEACHER='LIU'(C)){t|(u)(C(u)t[3]='LIU't[1]=u[1]t[2]=u[3])}(2)23S#,SNAME(AGE'23'SEX=''(S)){t|(u)(S(u)u[AGE]'23'u[SEX]=''t[1]=u[S#]t[2]=u[SNAME])}(,)S3CNAME,TEACHER(S#='S3'SC.C#=C.C#(SCC))(){t|(u)(v)(w)(S(u)SC(v)C(w)u[1]='S3'v[1]=u[1]v[2]=w[1]t[1]=w[2]t[2]=w[3])}LIUSNAME(SEX=''TEACHER='LIU'(S|X|SC|X|C)){t|(u)(v)(w)(S(u)SC(v)C(w)u[SEX]=''v[S#]=u[S#]v[C#]=w[C#]w[TEACHER]='LIU't[1]=u[SNAME])}WANGC#(SC)-C#(SNAME='WANG'S.S#=SC.S#(SSC)){t|(u)(v)(S(u)SC(v)u[SNAME]='WANG'u[S#]v[S#]t[1]=v[C#])}(WANGSNAME='WANG'WANG)S#(1=42(SCSC))(SC){t|(u)(v)(SC(u)SC(v)u[S#]=v[S#]u[C#]v[C#])t[1]=u[S#]}C#,S#(SC|X|(S#,C#(SC)S#(S)))(){t|(u)(v)(w)(SC(u)S(v)C(w)u[S#]=v[S#]u[C#]=w[C#]t[1]=u[C#]t[2]=v[S#])}LIUS#(TEACHER='LIU'(S|X|SC|X|C)){t|(u)(v)(w)(S(u)SC(v)C(w)u[1]=v[1]v[2]=w[1]w[3]='LIU't[1]=u[1])}3.15SSCC(1)(2)(1)CNAME,TEACHER(SEX=''(S|X|SC|X|C))(2)CNAMETEACHER(CNAME,TEACHER(C)|X|(S#,C#(SC)|X|S#(SEX=''(S))))44.1SQLSQLSQL(),()SQLSQL(StructuredQueryLanguage)SQLSQLSQL(BaseTable)SQL(StoredFile)SQL(View)SQL(row)SQL(coloumn)SQLSQLSQLSQLSQLSQLSQL4.2S(S#,SNAME,AGE,SEX)SC(S#,C#,GRADE)C(C#,CNAME,TEACHER)SQL1LIUSELECTC#CNAMEFROMCWHERETEACHER=LIU223SELECTS#SNAMEFROMSWHERE(AGE23)AND(SEX=M3LIUSELECTSNAMEFROMSWHERESEX=FANDS#IN(SELECTS#FROMSCWHEREC#IN(SELECTC#FROMCWHERETEACHER=LIU4WANGSELECTC#FROMCWHEREC#NOTIN(SELECTC#FROMSCWHERES#IN(SELECTS#FROMSWHERESNAME='WANG'))5SELECTS#FROMSCHAVINGCOUNT(C#)26SELECTC#,CNAMEFROMCWHERENOTEXISTS(SELECT*FROMSWHERENOTEXISTS(SELECT*FROMSCWHERESC.S#=S.S#ANDSC.C#=C.C#))7LIUSELECTS#FROMSWHERES#IN(SELECTS#FROMSCWHERES.S#=SC.S#ANDC#IN(SELECTC#FROMCWHERETEACHER='LIU'))SELECTDISTINGCTS#FROMSCWHEREEXISTS(SELECTC#FROMCWHERETEACHER='LIU')4.3RABCSDEFSQL1A(R)(2)B='17'(R)(3)R(4))A,F(C=D(RS)(1)SELECTAFROMR(2)SELECT*FROMRWHEREB='17'(3)SELECTA,B,C,D,E,FFROMR,S(4)SELECTA,FFROMR,SWHERER.C=S.D4.4RABCSABCSQL1R2R3RS4A,B(R)|X|B,C(S)(1)SELECTA,B,CFROMR,SWHERENOTEXISTS(SELECTA,B,CFROMR,SWHERER.A=S.AANDR.B=S.BANDR.C=S.C)(2)SELECTA,B,CFROMR,SWHERER.A=S.AANDR.B=S.BANDR.C=S.C(3)SELECTA,B,CFROMRWHERENOTEXISTS(SELECTA,B,CFROMSWHERER.A=S.AANDR.B=S.BANDR.C=S.C)(4)SELECTR.A,R.B,S.CFROMR,SWHERER.B=S.B4.5SQLSQL...4.6SQLSSCC1SELECTCOUNT(DISTINCTC#)FROMSC2C4SELECTAVG(AGE)FROMSWHERES#IN(SELECTS#FROMSCWHEREC#='C4')3LIUSELECTAVG(GRADE)FROMSCWHEREC#IN(SELECTC#FROMCWHERETEACHER='LIU')410SELECTDISTINCTC#,COUNT(S#)FROMSCGROUPBYC#HAVINGCOUNT(S#)10ORDERBY2,C#DESC5WANGSELCETSNAMEFROMSASXWHEREX.S#SOME(SELECTS#FROMSASYWHEREY.SNAME='WANG'ANDX.AGEY.AGE)p6WANGSELECTSNAME,AGEFROMSWHERESNAMELIKE'WANG%'7SCSELECTS#,C#FROMSCWHEREGRADEISNULL8SELECTSNAME,AGEFROMSASXWHEREX.SEX='M'ANDX.AGE(SELECTAVG(AGE)FROMSASYWHEREY.SEX='F')9SELECTSNAME,AGEFROMSASXWHEREX.SEX='M'ANDX.AGEALL(SELECTAGEFROMSASYWHEREY.SEX='F')4.7SQLSSCC1SS9WU18INSERTINTOS(S#,SNAME,AGE)VALUES('59','WU',18)2S80STUDENTSSANMESEXINSERTINTOSTUDENT(S#,SNAME,SEX)SELECTS#,SNAME,SEXFROMSWHERES#IN(SELECTS#FROMSCWHEREGRADE80)3SCDELETEFROMSCWHEREGRADEISNULL4WANGDELETEFROMSCWHERES#IN(SELECTS#FROMSWHERENAME='WANG')5MATHSUPDATESCSETGRADE=NULLWHERES#IN(SELECTS#FROMCWHERECNAME='MATHS')ANDSC.GRADE6065%UPDATESCSETGRADE=GRADE*1.05WHEREGRADE(SELECTAVG(GRADE)FROMSC)ANDS#IN(SELECTS#FROMSWHERESEX='F')7SCC4755%754%UPDATEUPDATESCSETGRADE=GRADE*1.05WHEREC#='C4'ANDGRADE=75UPDATESCSETGRADE=GRADE*1.04WHEREC#='C4'ANDGRADE754.8PARTPPNAMECOLORWEIGHTPROJECTJJNAMEDATESUPPLIERSSNAMESADDRPPJPTOTOALPSPSQUANTITY1SQLDDLCREATETABLEPART(P#CHAR(4)NOTNULL,PNAMECHAR(10)NOTNULL,COLORCHAR(10),WEIGHTREAL,PRIMARYKEY(P#,PNAME))CREATETABLEPROJECT(J#CHAR(4)NOTNULL,JNAMECHAR(10)NOTNULL,DATEDATE,PRIMARYKEY(J#))CREATETABLESUPLIER(S#CHAR(4)NOTNULL,SNAMECHAR(10),SADDRVARCHAR(10),PRIMARYKEY(S#)CREATETABLEP_P(J#CHAR(4),P#CHAR(4),TOTALINTEGER,FOREIGNKEY(J#,P#))CREATETABLEP_S(P#CHAR(4),S#CHAR(4),QUANTITYINTEGER,FOREIGNKEY(S#,P#))2PROGECTPPPARTVIEW1PARTPSSUPPLIERVIEW2CREATEVIEWVIEW1(P#,PNAME,COLOR,WEIG