Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Database Overview BasicTerminology Concepts SQL syntax Analysis Terms Term/Concept Definition Relational Model Represent information with tables or relations Relation Instance Table representing entity set or relation; each row of table representing an entity set represents an entity. Relation Schema Column headings or attribute names Database Schema Collection of relation schemas Type Constraint Values in a column are drawn from that datatype Data Atomiciy Single values in a column Analysis Terms Term/Concept Definition or Example Key A set of attributes which uniquely identifies an entity (row) of a relation (table) Key Constraint Any relation or table has at most one row for some combination of values of key attributes Foreign Key An attribute of a relation which serves as a primary key of another relation Foreign Key Constraint There is a tuple or row of the primary key table with same value as value of foreign key (referential integrity SQL Term/Concept Definition or Example Select Select <Attribute-List> From <Table-Expression> Where <Condition> <Attribute-List> * refers to all attributes or columns <Table-Expression> RentalProperty is table <Condition> Embedded SQL in as value of string variable in front end ID = PropertyID sql = "Select * from RentalProperty Where ID=" & Id ds = ExecuteSql(sql) RentalProperty Listbox Selecting a property from Listbox selects ID of property as SelectedValue property of Listbox which is used to select property object. SQL Term/Concept Definition or Example Example of returning all rental properties for Listbox sql = "Select * from RentalProperty order by name asc" Example uses an order by clause Gridview for Displaying all payments SQL Example of returning all payments (transactions) for Gridview Public Function FindAllTransactionsByTenant(ByVal TID As Long) As List(Of Transaction) Dim sql As String Dim ds As DataSet, dr As DataRow sql = "Select * from RentalTransaction where TenantID = " & TID & " Order By Transactiondate Desc" ds = ExecuteSql(sql) Dim transactions As New List(Of Transaction) For Each dr In ds.Tables(0).Rows Dim c As New Transaction(dr) transactions.Add(c) Next Return transactions End Function SQL Term/Concept Definition or Example Insert New Row Insert Into Table ( <Attribute_List> ) Values ( <Value_List>) Example of inserting a recipe 2 is the PropertyTypeID for Apartments Dim sql As String = "Insert Into Recipe(Name,Ingredients,Instructions) Values('" & c.Name & "','" & c.Ingredients & "','" & c.Instructions & "')" ExecuteSql(sql) SQL Term/Concept Definition or Example Insert New Row Insert Into Table ( <Attribute_List> ) Values ( <Value_List>) Example of inserting a recipe 2 is the PropertyTypeID for Apartments Dim sql As String = "Insert Into Recipe(Name,Ingredients,Instructions) Values('" & c.Name & "','" & c.Ingredients & "','" & c.Instructions & "')" ExecuteSql(sql) SQL Term/Concept Definition or Example Insert New Row Insert Into Table ( <Attribute_List> ) Values ( <Value_List>) Example of inserting a recipe Dim sql As String = "Insert Into Recipe(Name,Ingredients,Instructions) Values('" & c.Name & "','" & c.Ingredients & "','" & c.Instructions & "')" ExecuteSql(sql) SQL Term/Concept Definition or Example Update Existing Row Update Table Set ( <Attribute_Value_List>) Example of updating a recipe Public Sub UpdateRecipe(ByVal c As Recipe) Dim sql As String = "Update Recipe Set " & _ "Name ='" & c.Name & "'," & _ c.ID is the ID of the "Ingredients ='" & c.Ingredients & "'," & _ recipe to be updated "Instructions = '" & c.Instructions & "' Where ID=" & c.ID ExecuteSql(sql) End Sub