Management System • Sometimes called Information Management System • Software system designed to facilitate the storage, organization and retrieval of information. // Java Class.forName("com.mysql.jdbc.Driver"); static final String DB_URL = "jdbc:mysql://localhost/ASU"; DriverManager.getConnection(DB_URL,USER,PASS); Statement stmt = conn.createStatement(); String sqlInstruction = "SELECT id, first, last, age FROM Employees"; ResultSet rs = stmt.executeQuery(sqlInstruction); while(rs.next()){ // ...
Data Model define the logical structure of a database (entities, attributes, and relationship among data). Examples: • Relational Model (SQL Databases), • Object-Based, Document-Oriented, Key-value, Graph-Based Model, etc. (NoSQL databases)
Model § two-dimensional) tables – like an Excel spreadsheet, § with a fixed number of named columns (attributes) and § any number of rows of data (records) § Usually, tables have an identifier (a column) called primary key. § The relationships between data values is stored in the form of a table as well.
Mapping Mapping Entity: § Create table for each entity. § Entity’s attributes should become fields of tables with data types. § Declare primary key. Mapping Relationships § Create table for a relationship § Add the primary keys of all participating Entities as fields of table with their respective data types. § If relationship has any attribute, add each attribute as field of table. § Declare a primary key composing all the primary keys of participating entities. § Declare all foreign key constraints.
Query Language § SQL is a language for relational database. § SQL consists of many types of statements, which are sometimes called (sub)languages. E.g., data definition (DDL) and data manipulation (DML) sublanguages.
Manipulation Language Modifies the database instance by inserting, updating and deleting its data. Instructions: § INSERT INTO table (column1[, column2…]) VALUES (value1[,value2…]) § UPDATE table_name SET column_name=value [WHERE condition] § DELETE FROM table_name [WHERE condition] § SELECT column1[, column2…] FROM table [WHERE condition]