You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
where stringToChange is the string which will have the characters those we want to overwrite, startIndex is the starting position, length is the number of characters in the string that are to be overwrited, and new_characters are the new characters to write into the string.
1638
+
1639
+
- While REPLACE function is used to replace specified character at all its existing occurrences.
1640
+
- The syntax of REPLACE function is REPLACE (string_to_change, string_to_Replace, new_tring).
1641
+
- Every occurrence of string_to_change will be replaced by new_string.
1642
+
1643
+
<div align="right">
1644
+
<b><a href="#table-of-contents">↥ back to top</a></b>
1645
+
</div>
1646
+
1647
+
## Q. What is RANK function?
1648
+
1649
+
- RANK function can be used to give a rank to each row returned from a SELECT statment.
1650
+
- For using this function first specify the function name, followed by the empty parentheses.
1651
+
- Then mention the OVER function. For this function, you have to pass an ORDER BY clause as an argument. The clause identifies the column on which you are going to apply the RANK function.
1652
+
1653
+
For Example:
1654
+
SELECT RANK() OVER(ORDER BY BirthDate DESC) AS [RowNumber], FirstName, BirthDate FROM EmpDetails
1655
+
- In the result you will see that the eldest employee got the first rank and the youngest employee got the last rank. Here the rows with equal age will get same ranks.
1656
+
- The rank depends on the row's position in the result set, but not on the sequential number of the row.
1657
+
1658
+
<div align="right">
1659
+
<b><a href="#table-of-contents">↥ back to top</a></b>
1660
+
</div>
1661
+
1662
+
## Q. What are the reasons of poor performance of query?
1663
+
1664
+
Following are the reasons for the poor performance of a query:
1665
+
1666
+
* No indexes.
1667
+
* Excess recompilations of stored procedures.
1668
+
* Procedures and triggers without SET NOCOUNT ON.
1669
+
* Poorly written query with unnecessarily complicated joins.
1670
+
* Highly normalized database design.
1671
+
* Excess usage of cursors and temporary tables.
1672
+
* Queries with predicates that use comparison operators between different columns of the same table.
1673
+
* Queries with predicates that use operators, and any one of the following are true:
1674
+
* There are no statistics on the columns involved on either side of the operators.
1675
+
* The distribution of valuesin the statistics is not uniform, but the query seeks a highly selective value set. This situation can be especially true if the operator is anything other than the equality (=) operator.
1676
+
* The predicate uses the not equal to (!=) comparison operator or the NOT logical operator.
1677
+
* Queries that use any of the SQL Server built-in functions or a scalar-valued, user-defined function whose argument is not a constant value.
1678
+
* Queries that involve joining columns through arithmetic or string concatenation operators.
1679
+
* Queries that compare variables whose values are not known when the query is compiled and optimized.
1680
+
1681
+
<div align="right">
1682
+
<b><a href="#table-of-contents">↥ back to top</a></b>
1683
+
</div>
1684
+
1685
+
## Q. What are the MySQL Engines?
1686
+
1687
+
**1. InnoDB:**
1688
+
1689
+
The default storage engine in MySQL 8.0. InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL
1690
+
that has commit, rollback, and crash-recovery capabilities to protect user data. InnoDB row-level locking
1691
+
(without escalation to coarser granularity locks) and Oracle-style consistent nonlocking reads increase multi-user
1692
+
concurrency and performance. InnoDB stores user data in clustered indexes to reduce I/O for common queries based on primary keys.
1693
+
1694
+
To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints.
1695
+
1696
+
**2. MyISAM:**
1697
+
1698
+
These tables have a small footprint. Table-level locking limits the performance in read/write workloads, so it is often used in read-only or read-mostly workloads in Web and data warehousing configurations.
1699
+
1700
+
**3. Memory:**
1701
+
1702
+
Stores all data in RAM, for fast access in environments that require quick lookups of non-critical data. This engine
1703
+
was formerly known as the HEAP engine. Its use cases are decreasing; InnoDB with its buffer pool memory area provides a
1704
+
general-purpose and durable way to keep most or all data in memory, and NDBCLUSTER provides fast key-value lookups for huge distributed data sets.
1705
+
1706
+
**4. CSV:**
1707
+
1708
+
Its tables are really text files with comma-separated values. CSV tables let you import or dump data in CSV format, to exchange data with scripts and applications that read and write that same format. Because CSV tables are not indexed, you typically keep the data in InnoDB tables during normal operation, and only use CSV tables during the import or export stage.
1709
+
1710
+
**5. Archive:**
1711
+
1712
+
These compact, unindexed tables are intended for storing and retrieving large amounts of seldom-referenced historical, archived, or security audit information.
1713
+
1714
+
**6. Blackhole:**
1715
+
1716
+
The Blackhole storage engine accepts but does not store data, similar to the Unix /dev/null device. Queries always return an empty set. These tables can be used in replication configurations where DML statements are sent to slave servers, but the master server does not keep its own copy of the data.
1717
+
1718
+
**7. NDB:**
1719
+
1720
+
This clustered database engine is particularly suited for applications that require the highest possible degree
1721
+
of uptime and availability.
1722
+
1723
+
**8. Merge:**
1724
+
1725
+
Enables a MySQL DBA or developer to logically group a series of identical MyISAM tables and reference them as one object. Good for VLDB environments such as data warehousing.
1726
+
1727
+
**9. Federated:**
1728
+
1729
+
Offers the ability to link separate MySQL servers to create one logical database from many physical servers. Very good for distributed or data mart environments.
1730
+
1731
+
**10. Example:**
1732
+
1733
+
This engine serves as an example in the MySQL source code that illustrates how to begin writing new storage engines.
1734
+
It is primarily of interest to developers. The storage engine is a “stub” that does nothing. You can create tables with this engine, but no data can be stored in them or retrieved from them.
1735
+
1736
+
<div align="right">
1737
+
<b><a href="#table-of-contents">↥ back to top</a></b>
0 commit comments