0% found this document useful (0 votes)
47 views9 pages

Administrator-Account-0165811/: 2.data Definition Language

The root account is the most powerful user in a MySQL system. It has full permission to perform any administrative tasks. A database schema shows the structure of a database, including its tables and relationships. Data Definition Language (DDL) deals with creating database objects like tables and views.

Uploaded by

Rahul Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views9 pages

Administrator-Account-0165811/: 2.data Definition Language

The root account is the most powerful user in a MySQL system. It has full permission to perform any administrative tasks. A database schema shows the structure of a database, including its tables and relationships. Data Definition Language (DDL) deals with creating database objects like tables and views.

Uploaded by

Rahul Mishra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1. https://null-byte.wonderhowto.

com/forum/whats-difference-between-root-and-
administrator-account-0165811/

root account is created automatically by mysql and is a log on that is the most powerful user in the
system

used when we have to do super administrative tasks. Bcz it has all permission to do anything

2. database schema

is basically a database diagram showing us what tables are in our database and it's showing us
relationships and other information within our database.

So this database schema is very useful for seeing what tables you've created what database you've
created And more information on the tables here.

2.Data Definition Language

is a subsection of sql which deals with the creation

of database objects such as tables and views

FLOAT(M,D)

Eg 1.78 how long the no is ----M---3

HOW MANY nos go of the decimal pt---D—2

TIME is slightly different from DATETIME

Because this can hold a value which is more than 24 which is more than 99.99 hours.

So not just use four times a day.

It can be used for the time between two events.

So if two events took place more than 100 hours between then you can use the time data type.
TRUNCATE TABLE tablename;

basically what the truncate table statement is doing is dropping the table from the database or

deleting the test table from the example database and then creating a table again.

So it's running a drop table test and then it's running a create table test with the earlier columns

but there's no inserting the data back in

ALTER

when you drop a primary key column in a table it's not going to change the fact of

whether it can accept null values. It's still going to be set to No(null--no)

.bcz earlier it was set to no(null--no) (bcz it was PK)

CONSTRAINT

A constraint is something which is applied to table columns which restricts what kind of data can
be entered into that column. Constraints include:

primary keys,foreign keys,unique,not null,and many more!

When we create a foreign key we are creating a constraint on that particular column and we can
name that constraint.

If we want to remove the foreign key, and therefore remove the constraint, we can use the
constraint name to delete it.

So we basically says that particular column is used to that particular purpose only

https://stackoverflow.com/questions/12652629/differences-between-foreign-key-and-constraint-
foreign-key

The first one assigns a user-defined name to the foreign key, the second one will assign
a system-generated name to the foreign key.

User-defined foreign key names can be useful for subsequent statements like these:

ALTER TABLE XTable DROP CONSTRAINT fk_idq;


ALTER TABLE XTable ENABLE CONSTRAINT fk_idq;
ALTER TABLE XTable DISABLE CONSTRAINT fk_idq;
It's harder to alter constraints with system-generated names, as you have to discover
those names first.
https://stackoverflow.com/questions/13566876/difference-between-add-foreign-key-and-
add-constraint-fk-foreign-key

https://stackoverflow.com/questions/310561/mysql-terminology-constraints-vs-foreign-
keys-difference

https://stackoverflow.com/questions/16785561/what-is-the-difference-between-adding-
column-as-foreign-key-and-as-a-constraint

https://stackoverflow.com/questions/20473855/constraint-symbol-vs-foreign-key-index-
name-whats-the-difference imp

https://dba.stackexchange.com/questions/171434/when-creating-primary-and-foreign-
keys-is-the-constraint-keyword-optional

lec21 MUL still showing after dropping fk constraint

It is expected behavior but it could be a lot clearer.


When you create the foreign key on the address_id column, behind the scenes MySQL also creates
an index on this column. MUL is used for both foreign key and indexes.
When you drop the foreign key, the index is not removed so the MUL is still shown because the index
is still applied.
Really there should be separate words to make it clearer.

unique constraint

a column with a unique constraint applied to it means that it won't accept any duplicate

values of data within that column

SELECT*FROM table_name;

selects from a table does it returns all the columns and all

the rows of data we have in that table.


Just a thought

'To alter' is generally to change something in a way that some of the original is
retained. Also alter implies an agent making the change.

A change can be profound and can happen without intent or an agent.


Thus change is a more generic term and alter is a more specific term

https://www.quora.com/Could-anyone-tell-me-the-difference-between-alter-
change-switch-and-modify plz refer

1.Modify” is defined as “change in things like an opinion, a plan,


behavior, or a law slightly in order to improve it, make it better
and more acceptable.

2. “change” can be defined as “making the content, form, nature


or future course different from what it would be or from what it
is if left alone.”

3. 'To alter' is generally to change something in a way that some of the original is
retained. Also alter implies an agent making the change.

4.switch:

Change' in this sense means to alter or to discard in favour of another option. 'Switch'
implies to me that you are going to replace the item with another one and know what
the replacement will be. 'Switch' can also have the meaning of 'transpose'.

I need to change that lightbulb in the kitchen because it’s not working any more. I
haven’t got a new one so until I can get one, I’m going to switch it with the one in the
spare room that I don’t use very much.

To change and to switch out could be used interchangeably. But when using 'to change' you don't
necessarily have an idea of what is being changed to, whereas with 'to switch out' you are exchanging
something for something else.

Switch usually is a more specific exchange between two things whereas change is more general. You
can change your mind but you can never switch your mind because there is nothing to exchange it
with.
In this example because the addresses table has no rows of data in it it's an empty
table. But let's say we already had some data entered into our addresses table let's say
in the city column we already had some data entered like London Manchester or
Liverpool. Then if we try to modify the city's data type from VARCHAR(20) to INT It
wouldn't allow us to do this because the data that's already been entered is not
compatible with the data type. London is not an INT so we can't change the city data
type to an end. Simply we wouldn't be able to change it to a char because London
Manchester Liverpool have different lengths so we could have no CHAR with that
fixed length to satisfy London Manchester and LiverpoolR But we were able to
change the data type from VARCHAR(20) to 40 or 30 because London Manchester
and Liverpool are all compatible with VARCHAR( 20) VARCHAR (30) data type.

DDL was concerned with creating tables and now DML is concerned with inserting
data into those tables.

https://stackoverflow.com/questions/11448068/mysql-error-code-1175-during-update-in-mysql-
workbench before executing error query plz Query Menu -> Reconnect to Server

DIFFERENCE BETWEEN DELETE ,DROP AND REMOVE (ENGLISH NOT SQL)

Delete and remove are defined quite similarly, but the main difference between them
is that delete means erase (i.e. rendered nonexistent or nonrecoverable), while
remove connotes take away and set aside (but kept in existence). In your example, if
the item is existent after the removal, just say remove, but if it ceases to exist, say
delete. As a side note: delete is sometimes used of computer files to mean move to
trash/recycle bin (hence it is still recoverable), but that's not a standard meaning
outside of that context.

Drop---LET SOMETHING FALL, BECOME LESS ,

NOT INCLUDE, REDUCE,

STOP DOING SOMETHING,

STOP TALKING ABOUT SOMETHING

,TAKE SOMEBODY SOMEWHERE,

TAKE SOMETHING SOMEWHERE, VISIT


https://stackoverflow.com/questions/18673450/what-are-differences-between-and-
best-purposes-of-drop-truncate-and-delete

insql server

DROP will delete all data and the table structure as well.
DELETE will delete the data but the table structure will remain the same and we can still
rollback the data. Also with DELETE you can use the where condition i.e. to delete only
certain records.

https://stackoverflow.com/questions/2452524/what-is-the-difference-between-drop-and-
delete-database

BETWEEN

https://stackoverflow.com/questions/4809083/between-clause-versus-and

https://stackoverflow.com/questions/1960801/why-use-the-between-operator-when-we-
can-do-without-it

https://softwareengineering.stackexchange.com/questions/160191/why-is-sqls-between-
inclusive-rather-than-half-open

LIKE is used for pattern matching

LIKE ‘W%’ it is saying return words starting with w and any no of characters

%  any no of characters
_ just one character

 Sweaty----select-(choose)

 Feet

 Will----------restrict data

 Give--------put data into category

 Horrible------
 Odours—how can we order something before getting

restricted(where) data

 3.01 start before distinct

Full outer join

Now in other databases There's also a full join or an outer join which will

retrieve all the data from table 1 and Table 2. It doesn't matter if there's

missing rows in the table. It would just retrieve all the data from table one

and table 2 in mysql there's no such thing as a full join.


.

You might also like