Database schema vs database structure - mysql

What is the difference between database schema and database structure?
I am learning dbms and these two words are confusing for me. Dint find much information anywhere else.

Database schema and database structure can be used interchangeably, more or less. Most software developers will understand them to mean the same thing.
Schema in particular is used in two different ways:
A schema is like a folder that contains tables. You use statements like CREATE SCHEMA <schemaname>, DROP SCHEMA <schemaname>, USE <schemaname>. In MySQL, SCHEMA and DATABASE are synonyms in most contexts.
A schema is sometimes used to refer to the full definition of all objects in your project, including the schema, tables, indexes, procedures, functions, etc.

Related

What would be a good Database terminology to define sprocs, functions, views, triggers, column constraints, indexes?

*Stored procedures,
*functions,
*views,
*triggers,
*column constraints
*indexes
....
...
are Not pure Data. In other words, the aforementioned aspects of a database are Not Data.
What would be a good Database terminology to define the above Aspects in the Database technology field?
They are database objects. Database objects are described with Data definition language.

Difference Between Schema / Database in MySQL

Is there a difference between a schema and a database in MySQL? In SQL Server, a database is a higher level container in relation to a schema.
I read that Create Schema and Create Database do essentially the same thing in MySQL, which leads me to believe that schemas and databases are different words for the same objects.
As defined in the MySQL Glossary:
In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword SCHEMA instead of DATABASE in MySQL SQL syntax, for example using CREATE SCHEMA instead of CREATE DATABASE.
Some other database products draw a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the tables and other objects owned by a single user.
Depends on the database server. MySQL doesn't care, its basically the same thing.
Oracle, DB2, and other enterprise level database solutions make a distinction. Usually a schema is a collection of tables and a Database is a collection of schemas.
Refering to MySql documentation,
CREATE DATABASE creates a database with the given name. To use this
statement, you need the CREATE privilege for the database. CREATE
SCHEMA is a synonym for CREATE DATABASE as of MySQL 5.0.2.
PostgreSQL supports schemas, which is a subset of a database:
https://www.postgresql.org/docs/current/static/ddl-schemas.html
A database contains one or more named schemas, which in turn contain
tables. Schemas also contain other kinds of named objects, including
data types, functions, and operators. The same object name can be used
in different schemas without conflict; for example, both schema1 and
myschema can contain tables named mytable. Unlike databases, schemas
are not rigidly separated: a user can access objects in any of the
schemas in the database they are connected to, if they have privileges
to do so.
Schemas are analogous to directories at the operating system level, except that schemas cannot be nested.
In my humble opinion, MySQL is not a reference database. You should never quote MySQL for an explanation. MySQL implements non-standard SQL and sometimes claims features that it does not support. For example, in MySQL, CREATE schema will only create a DATABASE. It is truely misleading users.
This kind of vocabulary is called "MySQLism" by DBAs.
in MySQL schema is synonym of database.
Its quite confusing for beginner people who jump to MySQL and very first day find the word schema, so guys nothing to worry as both are same.
When you are starting MySQL for the first time you need to create a database (like any other database system) to work with so you can CREATE SCHEMA which is nothing but CREATE DATABASE
In some other database system schema represents a part of database or a collection of Tables, and collection of schema is a database.
Yes, people use these terms interchangeably with regard to MySQL. Though oftentimes you will hear people inappropriately refer to the entire database server as the database.
Simply if you are thinking or discussing about Mysql. Then take a simple answer
"SCHEMA & DATABASE are exactly the same thing, just a synthetic
sugar in mysql."
Just add some more info:
MongoDB also distinguish schema from database.
schema represent the tables, which means the structure of database.
Microsoft SQL Server for instance, Schemas refer to a single user and is another level of a container in the order of indicating the server, database, schema, tables, and objects.
For example, when you are intending to update dbo.table_a and the syntax isn't full qualified such as
UPDATE table.a the DBMS can't decide to use the intended table. Essentially by default the DBMS will utilize myuser.table_a
not like Postgres, SQL server schema is set of database have same thing
but in mysql schema and database it is the same
MySQL does not support the concept of schema. In MySQL, schema and schemas are synonyms for database and databases.
When a user connects to MySQL, they don't connect to a specific database. Instead, they can access any table they have permissions for

Mondrian - Fact Table Data as XML

I am evaluating a Mondrian-Saiku solution for a client.
After analyzing their current database schemas, I realize that what constitutes as their 'fact table data' is currently being stored in XML's. The XML 's themselves are stored as blob datatypes in a MySQL table. Think of it like this: the table holds all the transactions of the company; the details of each transaction are stored in their own XML; each XML string is stored as one of the field values in a given transaction row.
This presents a slight dilemma since the Mondrian XML schema requires the explicit use of column names.
Short of having to extract and transfer the XML data to new tables (not realistic for my purposes due to the size of data and dependencies from other systems), is there any way I can work my client's existing setup for the purposes of a Mondrian-Saiku implementation?
You need to expose the data in a traditional table way. What is the database here? Can you create a database view which does some xml processing on the XML in the blob and exposes the columns?
Alternatively maybe something like composite or jboss teiid can help here. These tools allow you to expose as a standard looking table, virtually anything. It may not be quick enough though!

What is the difference in View and EER Diagram?

I quite confuse with both. First, both might seen the same. May I know how the View and EER Diagram is apply?
View is a stored query accessible as a virtual table composed of the result set of a query. View is the perspective on the data from tables. It actually does not store data in it but give you the access like tables from the database only thing is you may not allow to insert data in to it.
EER/ER is nothing but data modelling techniques of the database. It is not acting on data but on the structure of tables in database. Generally it gives snapshot of tables & their relation. This is helpful to get the idea that howz the data flows in a database.

What is the MySQL equivalent of a PostgreSQL 'schema'?

I have a PostgreSQL database whose tables are divided amongst a number of schemas. Each schema has a different set of access controls; for example, one schema might be read-only to regular users, while they are allowed to create tables on another. Schemas also act as namespaces, so users don't have to worry about duplicating existing tables when they create new ones.
I want to create a similar setup using MySQL. Does it have an equivalent concept? If not, how can I most closely simulate it? I would prefer not to use multiple databases.
Database should be the closest one.
Prefixing table names is what's done with most MySQL-driven apps.