Repository: apache/shardingsphere
Issue: Rewrite error of derived alias

## Bug Report

**For English only**, other languages will not accept.

Before report a bug, make sure you have:

- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).

Please pay attention on issues you submitted, because we maybe need more details. 
If no response anymore and we cannot reproduce it on current information, we will **close it**.

Please answer these questions before submitting your issue. Thanks!

### Which version of ShardingSphere did you use?

5.0.0-RC1-SNAPSHOT

### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

Both

### Expected behavior

Correctly rewrite the following SQL:

```
SELECT SUM(order_id) AS orders_sum, user_id as `key` FROM t_order GROUP BY `key`
```

### Actual behavior

The logical SQL is rewritten to:

```
Actual SQL: ds_0 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_0 GROUP BY `key` ORDER BY `key` ASC 
Actual SQL: ds_0 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_1 GROUP BY `key` ORDER BY `key` ASC 
Actual SQL: ds_1 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_0 GROUP BY `key` ORDER BY `key` ASC 
Actual SQL: ds_1 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_1 GROUP BY `key` ORDER BY `key` ASC 
```

Lead to MySQL server respond error:

`ERROR 1054 (42S22): Unknown column 'key' in 'field list'`

### Reason analyze (If you can)

Rewrite error of derived alias

### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Refer to **Actual behavior**

### Example codes for reproduce this issue (such as a github link).

Refer to https://github.com/apache/shardingsphere/issues/6603

Changed files:
shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/engine/ProjectionsContextEngine.java
shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/Projection.java

diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/Projection.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/Projection.java
index 37f06b18d99..b6ababb8c00 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/Projection.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/Projection.java
@@ -37,7 +37,7 @@ public interface Projection {
      * @return alias
      */
     Optional<String> getAlias();
-
+    
     /**
      * Get columnLabel.
      *
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/engine/ProjectionsContextEngine.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/engine/ProjectionsContextEngine.java
index 6ecce295937..b282f2ecc23 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/engine/ProjectionsContextEngine.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/segment/select/projection/engine/ProjectionsContextEngine.java
@@ -34,6 +34,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.order.item.In
 import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.order.item.OrderByItemSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.order.item.TextOrderByItemSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtil;
 
 import java.util.Collection;
 import java.util.LinkedList;
@@ -180,7 +181,8 @@ public final class ProjectionsContextEngine {
     }
     
     private boolean isSameAlias(final Projection projection, final TextOrderByItemSegment orderItem) {
-        return projection.getAlias().isPresent() && (orderItem.getText().equalsIgnoreCase(projection.getAlias().get()) || orderItem.getText().equalsIgnoreCase(projection.getExpression()));
+        return projection.getAlias().isPresent() 
+                && (SQLUtil.getExactlyValue(orderItem.getText()).equalsIgnoreCase(projection.getAlias().get()) || orderItem.getText().equalsIgnoreCase(projection.getExpression()));
     }
     
     private boolean isSameQualifiedName(final Projection projection, final TextOrderByItemSegment orderItem) {