Elements table and alias it as a.Elements table itself, aliasing the second instance as b.a.type is 'Metal' and b.type is 'Nonmetal'.a.symbol as metal and b.symbol as nonmetal from the filtered results to get the desired output.
erDiagram
ELEMENTS {
varchar symbol PK
enum type
int electrons
}