Skip to main content

SQL Set Operators

SQL Set Operators   Traditional Set Operators: Union Compatibility:     Requirement for the traditional set operators.    Strong requirement.                         - Same number of columns.                         - Each corresponding column is compatible.                         - Positional correspondence.     Apply to similar tables by removing columns first. SQL UNION Example:           Example 1: Retrieve basic data about all university people.                     SELECT FacNo AS PerNo, FacFirstName                                      ...

DML | Data Manipulation Language

DML | Data Manipulation Language


            DML(Data Manipulation Language) : used for adding (inserting), deleting and modifying (updating) data in a database

                • Insert

                • Update

                • Delete


INSERT INTO:

            INSERT INTO table_name (column1, column2, column3, ...)
            VALUES (value1, value2, value3, ...);

            INSERT INTO table_name
            VALUES (value1, value2, value3, ...);


            create table mytab3(
            C1 int NOT NULL PRIMARY Key, c2
            varchar(255))

        insert into mytab3 values(01,'Ali')

            create table mytab5(
            c1 int, c2 int, c3 varchar(200),
            PRIMARY KEY (c1,c3),
            FOREIGN KEY (c2) REFERENCES
            mytab3(c1)


insert into mytab5 (c1)                    insert into mytab5 (c3)
values (10)                                       values ('Ahmed')


insert into mytab5 (c1,c2,c3)
values (111,60,'Ahmed')

                                                        insert into mytab5 (c1,c2,c3)
                                                        values (111,01,'Ahmed')


insert into mytab5 (c1,c3)                insert into mytab5 (c1,c3)                                             
values (09,'Ahmed')                          values (10,'Ahmed')

Re-Run


Update:

            UPDATE table_name
            SET column1 = value1, column2 = value2, ...
            WHERE condition;


update mytab5              update mytab5
set c1=12                      set c1=12
where c1=09                 where c1=10


update mytab5
set c1=13, c2=01,c3='aa'
where c1=12

update mytab5
set c1=13, c2=01,c3='aa'
where c1=12






Our Official Website : Web Conquerors (https://www.webconquerors.com/) 

Want to get digital services? Contact US

Want to know about our services? Our Services





Comments

Popular posts from this blog

SQL Set Operators

SQL Set Operators   Traditional Set Operators: Union Compatibility:     Requirement for the traditional set operators.    Strong requirement.                         - Same number of columns.                         - Each corresponding column is compatible.                         - Positional correspondence.     Apply to similar tables by removing columns first. SQL UNION Example:           Example 1: Retrieve basic data about all university people.                     SELECT FacNo AS PerNo, FacFirstName                                      ...
  d. Insert a new row in the Location table related to the Facility row in modification problem (c). The new row should have “Door” for the location name. Query Formulation + Result Snapshot Our Official Website :  Web Conquerors  (https://www.webconquerors.com/)  Want to get digital services?  Contact US Want to know about our services?  Our Services

Correction For ERD

 d. For each consistency error in Figure 1, you should identify the consistency rule violated and suggest possible resolutions of the error. The ERD has generic names to help will concentrate on finding diagram errors rather than focusing on the meaning of the diagram. Answer:                Entity6 is violation of the Primary key rule. As there are 3 attributes from within Entity6 that are marked as primary key. Entity6 also violates the Identifying relationship rule, as there is no foreign key in the Entity6 table to identify the item from Entity7. Since this a weak entity type, the cardinality must be 1:1, which it is not. Entity2 is a violation of the Identifying relationship rule due to it not being a weak entity type when there is an identifying relationship. Our Official Website :  Web Conquerors  (https://www.webconquerors.com/)  Want to get digital services?  Contact US Want to know about our services?  ...